summaryrefslogtreecommitdiff
path: root/test/HTML5
diff options
context:
space:
mode:
Diffstat (limited to 'test/HTML5')
-rw-r--r--test/HTML5/Html5Test.php4
-rw-r--r--test/HTML5/Serializer/OutputRulesTest.php28
2 files changed, 30 insertions, 2 deletions
diff --git a/test/HTML5/Html5Test.php b/test/HTML5/Html5Test.php
index 29ce83b..e30a3e3 100644
--- a/test/HTML5/Html5Test.php
+++ b/test/HTML5/Html5Test.php
@@ -288,13 +288,13 @@ class Html5Test extends TestCase {
$this->assertRegExp('|2 < 1|', $res);
$res = $this->cycle('<style>div>div>div</style>');
- $this->assertRegExp('|div&gt;div&gt;div|', $res);
+ $this->assertRegExp('|div>div>div|', $res);
$res = $this->cycleFragment('<script>2 < 1</script>');
$this->assertRegExp('|2 < 1|', $res);
$res = $this->cycleFragment('<style>div>div>div</style>');
- $this->assertRegExp('|div&gt;div&gt;div|', $res);
+ $this->assertRegExp('|div>div>div|', $res);
}
public function testEntities() {
diff --git a/test/HTML5/Serializer/OutputRulesTest.php b/test/HTML5/Serializer/OutputRulesTest.php
index 9a022c5..6ef8304 100644
--- a/test/HTML5/Serializer/OutputRulesTest.php
+++ b/test/HTML5/Serializer/OutputRulesTest.php
@@ -131,6 +131,34 @@ class OutputRulesTest extends \HTML5\Tests\TestCase {
</script>', stream_get_contents($stream, -1, 0));
}
+ function testElementWithStyle() {
+ $dom = \HTML5::loadHTML('<!doctype html>
+ <html lang="en">
+ <head>
+ <style>
+ body > .bar {
+ display: none;
+ }
+ </style>
+ </head>
+ <body>
+ <div id="foo" class="bar baz">foo bar baz</div>
+ </body>
+ </html>');
+
+ $stream = fopen('php://temp', 'w');
+ $r = new OutputRules($stream, \HTML5::options());
+ $t = new Traverser($dom, $stream, $r, \HTML5::options());
+
+ $style = $dom->getElementsByTagName('style');
+ $r->element($style->item(0));
+ $this->assertEquals('<style>
+ body > .bar {
+ display: none;
+ }
+ </style>', stream_get_contents($stream, -1, 0));
+ }
+
function testOpenTag() {
$dom = \HTML5::loadHTML('<!doctype html>
<html lang="en">