diff options
author | Matt Farina <[email protected]> | 2013-06-12 22:11:19 -0400 |
---|---|---|
committer | Matt Farina <[email protected]> | 2013-06-12 22:11:19 -0400 |
commit | 254ca181261fb5326dc3c9688562f800f18dd2e7 (patch) | |
tree | d330323a186fcc50f7369f43644e749326559215 /test/HTML5/Serializer/OutputRulesTest.php | |
parent | 095e2df659c2636eeebfd87414da9264aca82c21 (diff) |
#4 and #7, Cleaned up the MathMl support and added a test.
Diffstat (limited to 'test/HTML5/Serializer/OutputRulesTest.php')
-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 |