Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(325)

Side by Side Diff: third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGClipPathElement.html

Issue 2389803004: Convert LayoutTests/svg/dom/SVGAnimatedEnumeration*.html js-tests.js to testharness.js based tests. (Closed)
Patch Set: Align with review comments Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> 1 <!DOCTYPE HTML>
2 <html> 2 <title>Use of SVGAnimatedEnumeration within SVGClipPathElement</title>
3 <head> 3 <script src="../../resources/testharness.js"></script>
4 <script src="../../resources/js-test.js"></script> 4 <script src="../../resources/testharnessreport.js"></script>
5 </head> 5 <script>
6 <body> 6 test(function() {
7 <p id="description"></p> 7 // This test checks the use of SVGAnimatedEnumeration within SVGClipPathElemen t.
8 <div id="console"></div> 8
9 <script src="script-tests/SVGAnimatedEnumeration-SVGClipPathElement.js"></script > 9 var clipPathElement = document.createElementNS("http://www.w3.org/2000/svg", " clipPath");
10 </body> 10 clipPathElement.setAttribute("clipPathUnits", "userSpaceOnUse");
11 </html> 11
12 // Check initial 'clipPathUnits' value.
13 assert_true(clipPathElement.clipPathUnits instanceof SVGAnimatedEnumeration);
14 assert_equals(typeof(clipPathElement.clipPathUnits.baseVal), "number");
15 assert_equals(clipPathElement.clipPathUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYP E_USERSPACEONUSE);
16
17 // Switch to 'objectBoundingBox'.
18 clipPathElement.clipPathUnits.baseVal = SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUND INGBOX;
19 assert_equals(clipPathElement.clipPathUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYP E_OBJECTBOUNDINGBOX);
20 assert_equals(clipPathElement.getAttribute('clipPathUnits'), "objectBoundingBo x");
21
22 // Try setting invalid values.
23 assert_throws(new TypeError(), function() { clipPathElement.clipPathUnits.base Val = 3; });
24 assert_equals(clipPathElement.clipPathUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYP E_OBJECTBOUNDINGBOX);
25 assert_equals(clipPathElement.getAttribute('clipPathUnits'), "objectBoundingBo x");
26
27 assert_throws(new TypeError(), function() { clipPathElement.clipPathUnits.base Val = -1; });
28 assert_equals(clipPathElement.clipPathUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYP E_OBJECTBOUNDINGBOX);
29 assert_equals(clipPathElement.getAttribute('clipPathUnits'), "objectBoundingBo x");
30
31 assert_throws(new TypeError(), function() { clipPathElement.clipPathUnits.base Val = 0; });
32 assert_equals(clipPathElement.clipPathUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYP E_OBJECTBOUNDINGBOX);
33 assert_equals(clipPathElement.getAttribute('clipPathUnits'), "objectBoundingBo x");
34
35 // Switch to 'userSpaceOnUse'.
36 clipPathElement.clipPathUnits.baseVal = SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEON USE;
37 assert_equals(clipPathElement.clipPathUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYP E_USERSPACEONUSE);
38 assert_equals(clipPathElement.getAttribute('clipPathUnits'), "userSpaceOnUse") ;
39 });
40 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698