summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMatt Farina <[email protected]>2013-06-26 16:33:37 -0400
committerMatt Farina <[email protected]>2013-06-26 16:33:37 -0400
commit794331c4383121c00d883baa51f4e1fc110e80bc (patch)
treebd2f5f2be03ce8bbc6e5d6c228fe571b37cad85c /test
parenta7c74625e33b83519e3182a8553aa39763591f02 (diff)
Fixed an issue when writing fragments and trying to check for a tag name on a fragment.
Diffstat (limited to 'test')
-rw-r--r--test/HTML5/Serializer/SerializerTest.php15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/HTML5/Serializer/SerializerTest.php b/test/HTML5/Serializer/SerializerTest.php
index 2c59474..549eb98 100644
--- a/test/HTML5/Serializer/SerializerTest.php
+++ b/test/HTML5/Serializer/SerializerTest.php
@@ -27,6 +27,15 @@ class SerializerTest extends \HTML5\Tests\TestCase {
return $out;
}
+ protected function cycleFragment($fragment) {
+ $dom = \HTML5::loadHTMLFragment($fragment);
+ $options = \HTML5::options();
+ $ser = new Serializer($dom, $options);
+ $out = $ser->saveHTML();
+
+ return $out;
+ }
+
/**
* Wrap a html5 fragment in a html5 document to run through the parser.
*
@@ -137,10 +146,16 @@ class SerializerTest extends \HTML5\Tests\TestCase {
public function testComment() {
$res = $this->cycle($this->prepareHtml('a<!-- This is a test. -->b'));
$this->assertRegExp('|<!-- This is a test. -->|', $res);
+
+ $res = $this->cycleFragment('a<!-- This is a test. -->b');
+ $this->assertRegExp('|<!-- This is a test. -->|', $res);
}
public function testCDATA() {
$res = $this->cycle($this->prepareHtml('a<![CDATA[ This <is> a test. ]]>b'));
$this->assertRegExp('|<!\[CDATA\[ This <is> a test\. \]\]>|', $res);
+
+ $res = $this->cycleFragment('a<![CDATA[ This <is> a test. ]]>b');
+ $this->assertRegExp('|<!\[CDATA\[ This <is> a test\. \]\]>|', $res);
}
}