diff --git a/test/HTML5/Parser/DOMTreeBuilderTest.php b/test/HTML5/Parser/DOMTreeBuilderTest.php index 659378c..0183aed 100644 --- a/test/HTML5/Parser/DOMTreeBuilderTest.php +++ b/test/HTML5/Parser/DOMTreeBuilderTest.php @@ -457,14 +457,17 @@ public function testText() $data = $wrapper->childNodes->item(0); $this->assertEquals(XML_TEXT_NODE, $data->nodeType); $this->assertEquals('test', $data->data); + } + public function testTextBeforeHeadNotAllowed() + { // The DomTreeBuilder has special handling for text when in before head mode. - $html = ' - Foo'; + $html = 'Foo'; $doc = $this->parse($html); - $this->assertEquals('Line 0, Col 0: Unexpected text. Ignoring: Foo', $this->errors[0]); + $this->assertEquals('Line 0, Col 0: Unexpected head tag outside of head context.', $this->errors[0]); $headElement = $doc->documentElement->firstChild; $this->assertEquals('head', $headElement->tagName); + $this->assertXmlStringEqualsXmlString($doc, 'Foo'); } public function testParseErrors()