From b20e2f740c2c6c016299de65ca37906786eb5f7e Mon Sep 17 00:00:00 2001 From: Matt Farina Date: Wed, 12 Jun 2013 23:14:41 -0400 Subject: Added support for attributes without values and a attribute test. --- test/HTML5/Serializer/OutputRulesTest.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'test') diff --git a/test/HTML5/Serializer/OutputRulesTest.php b/test/HTML5/Serializer/OutputRulesTest.php index 70d3b7d..b6a53c6 100644 --- a/test/HTML5/Serializer/OutputRulesTest.php +++ b/test/HTML5/Serializer/OutputRulesTest.php @@ -205,6 +205,28 @@ class OutputRulesTest extends \HTML5\Tests\TestCase { $this->assertEquals('.+#', $m->invoke($o, '.+#')); } + function testAttrs() { + $dom = \HTML5::loadHTML(' + + +
foo bar baz
+ + '); + + $stream = fopen('php://temp', 'w'); + $t = new Traverser($dom, $stream, \HTML5::options()); + $p = $this->getTraverserProtectedProperty('rules'); + $o = $p->getValue($t); + + $list = $dom->getElementsByTagName('div'); + + $m = $this->getProtectedMethod('attrs'); + $m->invoke($o, $list->item(0)); + + $content = stream_get_contents($stream, -1, 0); + $this->assertEquals(' id="foo" class="bar baz" disabled', $content); + } + function testSvg() { $dom = \HTML5::loadHTML(' -- cgit v1.2.3