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

Unified Diff: LayoutTests/svg/dom/svglist-immutable.html

Issue 1061263005: Throw NoModificationAllowed in SVG*List.removeItem(...) if immutable (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Indentation. Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/core/svg/properties/SVGListPropertyTearOffHelper.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..9cdba100ab2a93c87c72ab5ce923a182b2c8ccbe
--- /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);
+ 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>
« no previous file with comments | « no previous file | Source/core/svg/properties/SVGListPropertyTearOffHelper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698