Index: third_party/WebKit/LayoutTests/svg/dom/SVGLengthList-xml-dom-modifications.html |
diff --git a/third_party/WebKit/LayoutTests/svg/dom/SVGLengthList-xml-dom-modifications.html b/third_party/WebKit/LayoutTests/svg/dom/SVGLengthList-xml-dom-modifications.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..89d4b3c2be8e9960b085ed336d31a0e2fba25242 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/svg/dom/SVGLengthList-xml-dom-modifications.html |
@@ -0,0 +1,62 @@ |
+<!DOCTYPE HTML> |
+<title>SVGLengthList, reaction to XML DOM modifications</title> |
fs
2016/09/17 17:42:37
I don't see anything particularly "XML" about this
Shanmuga Pandi
2016/09/19 07:40:04
Done.
|
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
+<svg width="200" height="200"> |
+ <text x="500 1000 1500" y="50"> ABC </text> |
+</svg> |
+<script> |
+test(function() { |
+ // This is a test how SVGLengthList reacts to XML DOM modifications. |
+ |
+ var text = document.querySelector("text"); |
+ var list = text.x.baseVal; |
+ assert_equals(list.numberOfItems, 3); |
+ |
+ var text1XBaseValGetItem0 = list.getItem(0); |
fs
2016/09/17 17:42:37
Maybe just rename these to "item0" (etc).
Shanmuga Pandi
2016/09/19 07:40:04
Done.
|
+ var text1XBaseValGetItem1 = list.getItem(1); |
+ var text1XBaseValGetItem2 = list.getItem(2); |
+ |
+ assert_equals(text1XBaseValGetItem0.value, 500); |
+ assert_equals(text1XBaseValGetItem1.value, 1000); |
+ assert_equals(text1XBaseValGetItem2.value, 1500); |
+ |
+ // Setting x = x - 250 on all three items. |
+ |
+ text1XBaseValGetItem0.value -= 250; |
+ text1XBaseValGetItem1.value -= 250; |
+ text1XBaseValGetItem2.value -= 250; |
+ |
+ assert_equals(text1XBaseValGetItem0.value, 250); |
+ assert_equals(text1XBaseValGetItem1.value, 750); |
+ assert_equals(text1XBaseValGetItem2.value, 1250); |
+ |
+ // Now using text.setAttribute('x', '50 100'). |
+ text.setAttribute("x", "50 100"); |
+ |
+ // Assure that the wrappers still point to the OLD values. |
+ assert_equals(text1XBaseValGetItem0.value, 250); |
+ assert_equals(text1XBaseValGetItem1.value, 750); |
+ assert_equals(text1XBaseValGetItem2.value, 1250); |
+ |
+ // Assure that obtaining new wrappers will give the right NEW values. |
+ assert_equals(list.numberOfItems, 2); |
+ assert_equals(list.getItem(0).value, 50); |
+ assert_equals(list.getItem(1).value, 100); |
+ |
+ // Setting x = x + 100 on all old wrapper items. |
+ text1XBaseValGetItem0.value += 100; |
+ text1XBaseValGetItem1.value += 100; |
+ text1XBaseValGetItem2.value += 100; |
+ |
+ // Assure that the old wrappers can still be modified, but don't influence the new wrappers. |
+ assert_equals(text1XBaseValGetItem0.value, 350); |
+ assert_equals(text1XBaseValGetItem1.value, 850); |
+ assert_equals(text1XBaseValGetItem2.value, 1350); |
+ |
+ // Assure that the new wrappers stayed the same. |
+ assert_equals(list.numberOfItems, 2); |
+ assert_equals(list.getItem(0).value, 50); |
+ assert_equals(list.getItem(1).value, 100); |
+}); |
+</script> |