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

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

Issue 2416163002: Convert LayoutTests/svg/dom/SVGAnimatedEnumeration*.html js-tests.js to testharness.js based tests. (Closed)
Patch Set: 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 SVGFEMorphologyElement</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 SVGFEMorphologyEl ement.
8 <div id="console"></div> 8
9 <script src="script-tests/SVGAnimatedEnumeration-SVGFEMorphologyElement.js"></sc ript> 9 var feMorphologyElement = document.createElementNS("http://www.w3.org/2000/svg ", "feMorphology");
10 </body> 10 feMorphologyElement.setAttribute("operator", "erode");
11 </html> 11
12 // Check initial 'operator' value.
13 assert_true(feMorphologyElement.operator instanceof SVGAnimatedEnumeration);
14 assert_equals(typeof(feMorphologyElement.operator.baseVal), "number");
15 assert_equals(feMorphologyElement.operator.baseVal, SVGFEMorphologyElement.SVG _MORPHOLOGY_OPERATOR_ERODE);
16
17 // Switch to 'dilate'.
18 feMorphologyElement.operator.baseVal = SVGFEMorphologyElement.SVG_MORPHOLOGY_O PERATOR_DILATE;
19 assert_equals(feMorphologyElement.operator.baseVal, SVGFEMorphologyElement.SVG _MORPHOLOGY_OPERATOR_DILATE);
20 assert_equals(feMorphologyElement.getAttribute('operator'), "dilate");
21
22 // Try setting invalid values.
23 assert_throws(new TypeError(), function() { feMorphologyElement.operator.baseV al = 4; });
24 assert_equals(feMorphologyElement.operator.baseVal, SVGFEMorphologyElement.SVG _MORPHOLOGY_OPERATOR_DILATE);
25 assert_equals(feMorphologyElement.getAttribute('operator'), "dilate");
26
27 assert_throws(new TypeError(), function() { feMorphologyElement.operator.baseV al = -1; });
28 assert_equals(feMorphologyElement.operator.baseVal, SVGFEMorphologyElement.SVG _MORPHOLOGY_OPERATOR_DILATE);
29 assert_equals(feMorphologyElement.getAttribute('operator'), "dilate");
30
31 assert_throws(new TypeError(), function() { feMorphologyElement.operator.baseV al = 0; });
32 assert_equals(feMorphologyElement.operator.baseVal, SVGFEMorphologyElement.SVG _MORPHOLOGY_OPERATOR_DILATE);
33 assert_equals(feMorphologyElement.getAttribute('operator'), "dilate");
34
35 // Switch to 'erode'.
36 feMorphologyElement.operator.baseVal = SVGFEMorphologyElement.SVG_MORPHOLOGY_O PERATOR_ERODE;
37 assert_equals(feMorphologyElement.operator.baseVal, SVGFEMorphologyElement.SVG _MORPHOLOGY_OPERATOR_ERODE);
38 assert_equals(feMorphologyElement.getAttribute('operator'), "erode");
39 });
40 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698