diff options
author | Matt Farina <[email protected]> | 2013-06-17 22:53:24 -0400 |
---|---|---|
committer | Matt Farina <[email protected]> | 2013-06-17 22:53:24 -0400 |
commit | 29ffdce6ef8be1b7fa3b2880d485c415769f8958 (patch) | |
tree | a802556027c395ddad8c74d90e3c78aaf9b077d2 /test | |
parent | 9cbb9602a16783df19e856cccd25d67a2f870be0 (diff) |
Added mathml tests to test case sensitivity and fixed the parser for the correct mathml tag name. Closing #7.
Diffstat (limited to 'test')
-rw-r--r-- | test/HTML5/Html5Test.php | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/test/HTML5/Html5Test.php b/test/HTML5/Html5Test.php index 88875a7..442fe63 100644 --- a/test/HTML5/Html5Test.php +++ b/test/HTML5/Html5Test.php @@ -98,7 +98,7 @@ class Html5Test extends TestCase { // Test a mixed case attribute. $list = $dom->getElementsByTagName('svg'); - $this->assertNotEmpty($list); + $this->assertNotEmpty($list->length); $svg = $list->item(0); $this->assertEquals("0 0 3 2", $svg->getAttribute('viewBox')); $this->assertFalse($svg->hasAttribute('viewbox')); @@ -106,7 +106,7 @@ class Html5Test extends TestCase { // Test a mixed case tag. // Note: getElementsByTagName is not case sensetitive. $list = $dom->getElementsByTagName('textPath'); - $this->assertNotEmpty($list); + $this->assertNotEmpty($list->length); $textPath = $list->item(0); $this->assertEquals('textPath', $textPath->tagName); $this->assertNotEquals('textpath', $textPath->tagName); @@ -117,4 +117,38 @@ class Html5Test extends TestCase { } + public function testMathMl() { + $dom = \HTML5::loadHTML('<!doctype html> + <html lang="en"> + <body> + <div id="foo" class="bar baz" definitionURL="http://example.com">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>'); + + $this->assertEmpty($dom->errors); + $list = $dom->getElementsByTagName('math'); + $this->assertNotEmpty($list->length); + + $list = $dom->getElementsByTagName('div'); + $this->assertNotEmpty($list->length); + $div = $list->item(0); + $this->assertEquals('http://example.com', $div->getAttribute('definitionurl')); + $this->assertFalse($div->hasAttribute('definitionURL')); + $list = $dom->getElementsByTagName('csymbol'); + $csymbol = $list->item(0); + $this->assertEquals('http://www.example.com/mathops/multiops.html#plusminus', $csymbol->getAttribute('definitionURL')); + $this->assertFalse($csymbol->hasAttribute('definitionurl')); + + $html = \HTML5::saveHTML($dom); + $this->assertRegExp('|<csymbol definitionURL="http://www.example.com/mathops/multiops.html#plusminus">|',$html); + $this->assertRegExp('|<mi>y</mi>|',$html); + } + } |