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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/dom/ranges/StaticRange-no-mutation.html

Issue 2791373002: [InputEvent] Make StaticRange immutable and move tests to wpt (Closed)
Patch Set: Created 3 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 unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!doctype html>
2 <html> 2 <title>StaticRange: No mutate on DOM changes</title>
3 <head> 3 <script src="/resources/testharness.js"></script>
4 <title>StaticRange: No mutate on DOM change</title> 4 <script src="/resources/testharnessreport.js"></script>
5 <script src="../../../resources/testharness.js"></script> 5 <div id='txt'>
6 <script src="../../../resources/testharnessreport.js"></script>
7 </head>
8 <body>
9 abcdefg 6 abcdefg
7 </div>
10 <script> 8 <script>
11 test(function() { 9 test(() => {
12 // Initialize. 10 // Initialize.
13 var txt = document.body.firstChild; 11 const txt = document.getElementById('txt').firstChild;
14 var staticRange = new StaticRange(); 12 const staticRange = new StaticRange();
15 staticRange.setStart(txt, 0); 13 staticRange.setStart(txt, 0);
16 staticRange.setEnd(txt, 5); 14 staticRange.setEnd(txt, 5);
17 var range = staticRange.toRange(); 15 const range = staticRange.toRange();
foolip 2017/04/04 04:32:36 Add a test for when this throws an exception, or r
chongz 2017/04/07 18:14:11 Removed |toRange()|.
18 16
19 // Split text and StaticRange shouldn't mutate. 17 // Split text and StaticRange shouldn't mutate.
20 txt.splitText(2); 18 txt.splitText(2);
21 assert_equals(staticRange.startContainer, txt); 19 assert_equals(staticRange.startContainer, txt);
22 assert_equals(staticRange.startOffset, 0); 20 assert_equals(staticRange.startOffset, 0);
23 assert_equals(staticRange.endContainer, txt); 21 assert_equals(staticRange.endContainer, txt);
24 assert_equals(staticRange.endOffset, 5); 22 assert_equals(staticRange.endOffset, 5);
25 23
26 // Range should mutate. 24 // Range should mutate.
27 assert_equals(range.startContainer, txt); 25 assert_equals(range.startContainer, txt);
28 assert_equals(range.startOffset, 0); 26 assert_equals(range.startOffset, 0);
29 assert_equals(range.endContainer, txt.nextSibling); 27 assert_equals(range.endContainer, txt.nextSibling);
30 assert_equals(range.endOffset, 3); 28 assert_equals(range.endOffset, 3);
31 }, 'Testing StaticRange wont mutate on DOM change'); 29 }, 'StaticRange does not mutate on DOM changes');
foolip 2017/04/04 04:32:36 If you make this the <title> you can omit it here,
chongz 2017/04/07 18:14:11 Removed this test as we have no way to set the att
32 </script> 30 </script>
33 </body>
34 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698