summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMatt Farina <[email protected]>2013-06-12 23:14:41 -0400
committerMatt Farina <[email protected]>2013-06-12 23:14:41 -0400
commitb20e2f740c2c6c016299de65ca37906786eb5f7e (patch)
tree924afc7fd49907f48516587cd0e86f6661a476cc /test
parent254ca181261fb5326dc3c9688562f800f18dd2e7 (diff)
Added support for attributes without values and a attribute test.
Diffstat (limited to 'test')
-rw-r--r--test/HTML5/Serializer/OutputRulesTest.php22
1 files changed, 22 insertions, 0 deletions
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('&period;&plus;&num;', $m->invoke($o, '.+#'));
}
+ function testAttrs() {
+ $dom = \HTML5::loadHTML('<!doctype html>
+ <html lang="en">
+ <body>
+ <div id="foo" class="bar baz" disabled>foo bar baz</div>
+ </body>
+ </html>');
+
+ $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('<!doctype html>
<html lang="en">