summaryrefslogtreecommitdiff
path: root/test/HTML5
diff options
context:
space:
mode:
authorMatt Butcher <[email protected]>2013-05-02 11:02:07 -0500
committerMatt Butcher <[email protected]>2013-05-02 11:02:07 -0500
commit7b243b238c29e787686cb60fe418c1cd21a6dd58 (patch)
tree036b001cc30509936126eb557cb7e06a554d08e0 /test/HTML5
parentdd4a88998609e7efa6203b2ee776aac6d9df9b1c (diff)
Rules for LI, DT, DD, RT, and RP.
Diffstat (limited to 'test/HTML5')
-rw-r--r--test/HTML5/Parser/TreeBuildingRulesTest.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/HTML5/Parser/TreeBuildingRulesTest.php b/test/HTML5/Parser/TreeBuildingRulesTest.php
index 3ca3cbb..fe02893 100644
--- a/test/HTML5/Parser/TreeBuildingRulesTest.php
+++ b/test/HTML5/Parser/TreeBuildingRulesTest.php
@@ -14,6 +14,8 @@ require_once __DIR__ . '/../TestCase.php';
*/
class TreeBuildingRulesTest extends \HTML5\Tests\TestCase {
+ const HTML_STUB = '<!DOCTYPE html><html><head><title>test</title></head><body>%s</body></html>';
+
/**
* Convenience function for parsing.
*/
@@ -36,4 +38,28 @@ class TreeBuildingRulesTest extends \HTML5\Tests\TestCase {
$this->assertFalse($engine->hasRules('imaginary'));
}
+ public function testHandleLI() {
+ $html = sprintf(self::HTML_STUB, '<ul id="a"><li>test<li>test2</ul><a></a>');
+ $doc = $this->parse($html);
+
+ $list = $doc->getElementById('a');
+
+ $this->assertEquals(2, $list->childNodes->length);
+ foreach($list->childNodes as $ele) {
+ $this->assertEquals('li', $ele->tagName);
+ }
+
+ }
+
+ public function testHandleDT() {
+ $html = sprintf(self::HTML_STUB, '<dl id="a"><dt>Hello<dd>Hi</dl><a></a>');
+ $doc = $this->parse($html);
+
+ $list = $doc->getElementById('a');
+
+ $this->assertEquals(2, $list->childNodes->length);
+ $this->assertEquals('dt', $list->firstChild->tagName);
+ $this->assertEquals('dd', $list->lastChild->tagName);
+ }
+
}