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

Side by Side Diff: third_party/WebKit/LayoutTests/svg/dom/SVGLengthList-dom-modifications.html

Issue 2344403002: Convert LayoutTests/svg/dom/SVGLengthList*.html js-tests.js to testharness.js based tests (Closed)
Patch Set: Align with review comments Created 4 years, 3 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
(Empty)
1 <!DOCTYPE HTML>
2 <title>SVGLengthList, reaction to DOM modifications</title>
3 <script src="../../resources/testharness.js"></script>
4 <script src="../../resources/testharnessreport.js"></script>
5 <svg width="200" height="200">
6 <text x="500 1000 1500" y="50"> ABC </text>
7 </svg>
8 <script>
9 test(function() {
10 // This is a test how SVGLengthList reacts to DOM modifications.
11
12 var text = document.querySelector("text");
13 var list = text.x.baseVal;
14 assert_equals(list.numberOfItems, 3);
15
16 var item0 = list.getItem(0);
17 var item1 = list.getItem(1);
18 var item2 = list.getItem(2);
19
20 assert_equals(item0.value, 500);
21 assert_equals(item1.value, 1000);
22 assert_equals(item2.value, 1500);
23
24 // Setting x = x - 250 on all three items.
25
26 item0.value -= 250;
27 item1.value -= 250;
28 item2.value -= 250;
29
30 assert_equals(item0.value, 250);
31 assert_equals(item1.value, 750);
32 assert_equals(item2.value, 1250);
33
34 // Now using text.setAttribute('x', '50 100').
35 text.setAttribute("x", "50 100");
36
37 // Assure that the wrappers still point to the OLD values.
38 assert_equals(item0.value, 250);
39 assert_equals(item1.value, 750);
40 assert_equals(item2.value, 1250);
41
42 // Assure that obtaining new wrappers will give the right NEW values.
43 assert_equals(list.numberOfItems, 2);
44 assert_equals(list.getItem(0).value, 50);
45 assert_equals(list.getItem(1).value, 100);
46
47 // Setting x = x + 100 on all old wrapper items.
48 item0.value += 100;
49 item1.value += 100;
50 item2.value += 100;
51
52 // Assure that the old wrappers can still be modified, but don't influence the new wrappers.
53 assert_equals(item0.value, 350);
54 assert_equals(item1.value, 850);
55 assert_equals(item2.value, 1350);
56
57 // Assure that the new wrappers stayed the same.
58 assert_equals(list.numberOfItems, 2);
59 assert_equals(list.getItem(0).value, 50);
60 assert_equals(list.getItem(1).value, 100);
61 });
62 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698