Chromium Code Reviews| 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..5d7cd8fa9d8227ff503c0751440845bf333a546f |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/svg/dom/SVGLengthList-xml-dom-modifications.html |
| @@ -0,0 +1,62 @@ |
| +<!DOCTYPE HTML> |
| +<title>SVGLengthList, reacts to XML DOM modifications</title> |
|
Srirama
2016/09/17 11:27:53
nit: s/reacts/reaction
Shanmuga Pandi
2016/09/17 12:29:34
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); |
| + 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> |