From 608bb4ba191cf3b40c29b28347c2a75e7c043246 Mon Sep 17 00:00:00 2001 From: Matt Farina Date: Wed, 24 Apr 2013 06:04:07 -0400 Subject: Added SVG to the element setup. --- test/HTML5/ElementsTest.php | 108 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) (limited to 'test/HTML5/ElementsTest.php') diff --git a/test/HTML5/ElementsTest.php b/test/HTML5/ElementsTest.php index 318b210..20161bb 100644 --- a/test/HTML5/ElementsTest.php +++ b/test/HTML5/ElementsTest.php @@ -162,6 +162,89 @@ class ElementsTest extends TestCase { "munderover", ); + public $svgElements = array( + "a", + "altGlyph", + "altGlyphDef", + "altGlyphItem", + "animate", + "animateColor", + "animateMotion", + "animateTransform", + "circle", + "clipPath", + "color-profile", + "cursor", + "defs", + "desc", + "ellipse", + "feBlend", + "feColorMatrix", + "feComponentTransfer", + "feComposite", + "feConvolveMatrix", + "feDiffuseLighting", + "feDisplacementMap", + "feDistantLight", + "feFlood", + "feFuncA", + "feFuncB", + "feFuncG", + "feFuncR", + "feGaussianBlur", + "feImage", + "feMerge", + "feMergeNode", + "feMorphology", + "feOffset", + "fePointLight", + "feSpecularLighting", + "feSpotLight", + "feTile", + "feTurbulence", + "filter", + "font", + "font-face", + "font-face-format", + "font-face-name", + "font-face-src", + "font-face-uri", + "foreignObject", + "g", + "glyph", + "glyphRef", + "hkern", + "image", + "line", + "linearGradient", + "marker", + "mask", + "metadata", + "missing-glyph", + "mpath", + "path", + "pattern", + "polygon", + "polyline", + "radialGradient", + "rect", + "script", + "set", + "stop", + "style", + "svg", + "switch", + "symbol", + "text", + "textPath", + "title", + "tref", + "tspan", + "use", + "view", + "vkern", + ); + public function testIsHtml5Element() { foreach ($this->html5Elements as $element) { @@ -192,6 +275,20 @@ class ElementsTest extends TestCase { } } + public function testIsSvgElement() { + foreach ($this->svgElements as $element) { + $this->assertTrue(Elements::isSvgElement($element), 'SVG element test failed on: ' . $element); + + // SVG is case sensetitive so these should all fail. + $this->assertFalse(Elements::isSvgElement(strtoupper($element)), 'SVG element test failed on: ' . strtoupper($element)); + } + + $nonSVG = array('foo', 'bar', 'baz'); + foreach ($nonSVG as $element) { + $this->assertFalse(Elements::isSvgElement($element), 'SVG element test failed on: ' . $element); + } + } + public function testIsElement() { foreach ($this->html5Elements as $element) { $this->assertTrue(Elements::isElement($element), 'html5 element test failed on: ' . $element); @@ -206,6 +303,17 @@ class ElementsTest extends TestCase { $this->assertFalse(Elements::isElement(strtoupper($element)), 'MathML element test failed on: ' . strtoupper($element)); } + foreach ($this->svgElements as $element) { + $this->assertTrue(Elements::isElement($element), 'SVG element test failed on: ' . $element); + + // SVG is case sensetitive so these should all fail. But, there is duplication + // html5 and SVG. Since html5 is case insensetitive we need to make sure + // it's not a html5 element first. + if (!in_array($element, $this->html5Elements)) { + $this->assertFalse(Elements::isElement(strtoupper($element)), 'SVG element test failed on: ' . strtoupper($element)); + } + } + $nonhtml5 = array('foo', 'bar', 'baz'); foreach ($nonhtml5 as $element) { $this->assertFalse(Elements::isElement($element), 'html5 element test failed on: ' . $element); -- cgit v1.2.3