Chromium Code Reviews| Index: LayoutTests/svg/dom/svglist-immutable.html |
| diff --git a/LayoutTests/svg/dom/svglist-immutable.html b/LayoutTests/svg/dom/svglist-immutable.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..0bcba2ded3caa9b39485ae25b188588208e58962 |
| --- /dev/null |
| +++ b/LayoutTests/svg/dom/svglist-immutable.html |
| @@ -0,0 +1,41 @@ |
| +<!DOCTYPE html> |
| +<title>SVG*List immutability</title> |
| +<script src=../../resources/testharness.js></script> |
| +<script src=../../resources/testharnessreport.js></script> |
| +<script> |
| +var root = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); |
| +[ |
| + { |
| + element: 'path', attr: 'd', value: 'M0,0l10,10', listName: 'SVGPathSegList', |
| + accessor: function(elm) { return elm.animatedPathSegList; }, |
| + constructItem: function(elm) { return elm.createSVGPathSegLinetoAbs(20, 20); } |
| + }, { |
| + element: 'polygon', attr: 'points', value: '0,0 10,10', listName: 'SVGPointList', |
| + accessor: function(elm) { return elm.animatedPoints; }, |
| + constructItem: function(elm) { return root.createSVGPoint(); } |
| + }, { |
| + element: 'text', attr: 'x', value: '0 10', listName: 'SVGLengthList', |
| + accessor: function(elm) { return elm.x.animVal; }, |
| + constructItem: function(elm) { return root.createSVGLength(); } |
| + }, { |
| + element: 'rect', attr: 'transform', value: 'rotate(0) scale(1)', listName: 'SVGTransformList', |
| + accessor: function(elm) { return elm.transform.animVal; }, |
| + constructItem: function(elm) { return root.createSVGTransform(); } |
| + } |
| +].forEach(function(testItem) { |
| + var element = document.createElementNS('http://www.w3.org/2000/svg', testItem.element); |
| + element.setAttribute(testItem.attr, testItem.value); |
| + var list = testItem.accessor(element); |
| + var item = testItem.constructItem(element); |
| + test(function() { |
| + assert_equals(list.length, 2); |
|
pdr.
2015/04/24 22:28:12
Indentation (here, elsewhere)
fs
2015/04/27 10:24:29
Bah, fixed.
|
| + assert_throws('NoModificationAllowedError', function() { list.clear(); }); |
| + assert_throws('NoModificationAllowedError', function() { list.initialize(item); }); |
| + assert_throws('NoModificationAllowedError', function() { list[0] = item; }); |
| + assert_throws('NoModificationAllowedError', function() { list.insertItemBefore(item, 0); }); |
| + assert_throws('NoModificationAllowedError', function() { list.replaceItem(item, 0); }); |
| + assert_throws('NoModificationAllowedError', function() { list.removeItem(0); }); |
| + assert_throws('NoModificationAllowedError', function() { list.appendItem(item); }); |
| + }, document.title + ', ' + testItem.listName); |
| +}); |
| +</script> |