diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/HTML5/Serializer/OutputRulesTest.php | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/HTML5/Serializer/OutputRulesTest.php b/test/HTML5/Serializer/OutputRulesTest.php index 768434c..70d3b7d 100644 --- a/test/HTML5/Serializer/OutputRulesTest.php +++ b/test/HTML5/Serializer/OutputRulesTest.php @@ -36,6 +36,13 @@ class OutputRulesTest extends \HTML5\Tests\TestCase { return $method; } + function getTraverserProtectedProperty($name) { + $class = new \ReflectionClass('\HTML5\Serializer\Traverser'); + $property = $class->getProperty($name); + $property->setAccessible(true); + return $property; + } + function getOutputRules($options = array()) { $options = $options + \HTML5::options(); $stream = fopen('php://temp', 'w'); @@ -220,4 +227,31 @@ class OutputRulesTest extends \HTML5\Tests\TestCase { $this->assertRegExp('|<svg width="150" height="100" viewBox="0 0 3 2">|', stream_get_contents($stream, -1, 0)); } + function testMath() { + $dom = \HTML5::loadHTML('<!doctype html> + <html lang="en"> + <body> + <div id="foo" class="bar baz">foo bar baz</div> + <math> + <mi>x</mi> + <csymbol definitionURL="http://www.example.com/mathops/multiops.html#plusminus"> + <mo>±</mo> + </csymbol> + <mi>y</mi> + </math> + </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('math'); + $o->element($list->item(0)); + $content = stream_get_contents($stream, -1, 0); + $this->assertRegExp('|<math>|', $content); + $this->assertRegExp('|<csymbol definitionURL="http://www.example.com/mathops/multiops.html#plusminus">|', $content); + } + }
\ No newline at end of file |