You are here

public function DOMTreeBuilderTest::testSVGAttributes in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/masterminds/html5/test/HTML5/Parser/DOMTreeBuilderTest.php \Masterminds\HTML5\Tests\Parser\DOMTreeBuilderTest::testSVGAttributes()

File

vendor/masterminds/html5/test/HTML5/Parser/DOMTreeBuilderTest.php, line 281
Test the Tree Builder.

Class

DOMTreeBuilderTest
These tests are functional, not necessarily unit tests.

Namespace

Masterminds\HTML5\Tests\Parser

Code

public function testSVGAttributes() {
  $html = "<!DOCTYPE html>\n      <html><body>\n      <svg width='150' viewbox='2'>\n      <rect textlength='2'/>\n      <animatecolor>foo</animatecolor>\n      </svg>\n      </body></html>";
  $doc = $this
    ->parse($html);
  $root = $doc->documentElement;
  $svg = $root
    ->getElementsByTagName('svg')
    ->item(0);
  $this
    ->assertTrue($svg
    ->hasAttribute('viewBox'));
  $rect = $root
    ->getElementsByTagName('rect')
    ->item(0);
  $this
    ->assertTrue($rect
    ->hasAttribute('textLength'));
  $ac = $root
    ->getElementsByTagName('animateColor');
  $this
    ->assertEquals(1, $ac->length);
}