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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/selection/isCollapsed.html

Issue 2709623002: selection: Do not run invalid sub-tests with unselectable endpoints. (Closed)
Patch Set: Created 3 years, 10 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 <title>Selection.isCollapsed tests</title> 2 <title>Selection.isCollapsed tests</title>
3 <div id=log></div> 3 <div id=log></div>
4 <script src=/resources/testharness.js></script> 4 <script src=/resources/testharness.js></script>
5 <script src=/resources/testharnessreport.js></script> 5 <script src=/resources/testharnessreport.js></script>
6 <script src=common.js></script> 6 <script src=common.js></script>
7 <script> 7 <script>
8 "use strict"; 8 "use strict";
9 9
10 test(function() { 10 test(function() {
11 selection.removeAllRanges(); 11 selection.removeAllRanges();
12 assert_true(selection.isCollapsed, "isCollapsed must be true if both anchor and focus are null"); 12 assert_true(selection.isCollapsed, "isCollapsed must be true if both anchor and focus are null");
13 }, "Empty selection"); 13 }, "Empty selection");
14 14
15 for (var i = 0; i < testRanges.length; i++) { 15 for (var i = 0; i < testRanges.length; i++) {
16 var endpoints = eval(testRanges[i]);
17 if (!isSelectableNode(endpoints[0]) || !isSelectableNode(endpoints[2]))
18 continue;
16 test(function() { 19 test(function() {
17 selection.removeAllRanges(); 20 selection.removeAllRanges();
18 var endpoints = eval(testRanges[i]);
19 var range = ownerDocument(endpoints[0]).createRange(); 21 var range = ownerDocument(endpoints[0]).createRange();
20 range.setStart(endpoints[0], endpoints[1]); 22 range.setStart(endpoints[0], endpoints[1]);
21 range.setEnd(endpoints[2], endpoints[3]); 23 range.setEnd(endpoints[2], endpoints[3]);
22 selection.addRange(range); 24 selection.addRange(range);
23 25
24 assert_equals(selection.isCollapsed, 26 assert_equals(selection.isCollapsed,
25 endpoints[0] === endpoints[2] && endpoints[1] === endpoints[3], 27 endpoints[0] === endpoints[2] && endpoints[1] === endpoints[3],
26 "Value of isCollapsed"); 28 "Value of isCollapsed");
27 }, "Range " + i + " " + testRanges[i]); 29 }, "Range " + i + " " + testRanges[i]);
28 } 30 }
29 31
30 testDiv.style.display = "none"; 32 testDiv.style.display = "none";
31 </script> 33 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698