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

Side by Side Diff: third_party/WebKit/LayoutTests/imported/wpt/selection/removeAllRanges.html

Issue 2630243004: Manually import wpt/editing and wpt/selection/ (Closed)
Patch Set: Add expectation Created 3 years, 11 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>Selection.removeAllRanges() tests</title>
3 <div id=log></div>
4 <script src=/resources/testharness.js></script>
5 <script src=/resources/testharnessreport.js></script>
6 <script src=common.js></script>
7 <script>
8 "use strict";
9
10 // Also test a selection with no ranges
11 testRanges.unshift("[]");
12
13 var range = rangeFromEndpoints([paras[0].firstChild, 0, paras[0].firstChild, 1]) ;
14
15 for (var i = 0; i < testRanges.length; i++) {
16 test(function() {
17 setSelectionForwards(eval(testRanges[i]));
18 selection.removeAllRanges();
19 assert_equals(selection.rangeCount, 0,
20 "After removeAllRanges(), rangeCount must be 0");
21 // Test that it's forwards
22 selection.addRange(range);
23 assert_equals(selection.anchorOffset, selection.getRangeAt(0).startOffse t,
24 "After removeAllRanges(), addRange() must be forwards, so anchorOffs et must equal startOffset rather than endOffset");
25 assert_equals(selection.focusOffset, selection.getRangeAt(0).endOffset,
26 "After removeAllRanges(), addRange() must be forwards, so focusOffse t must equal endOffset rather than startOffset");
27 }, "Range " + i + " " + testRanges[i] + " forwards");
28
29 // Copy-pasted from above
30 test(function() {
31 setSelectionBackwards(eval(testRanges[i]));
32 selection.removeAllRanges();
33 assert_equals(selection.rangeCount, 0,
34 "After removeAllRanges(), rangeCount must be 0");
35 // Test that it's forwards
36 selection.addRange(range);
37 assert_equals(selection.anchorOffset, selection.getRangeAt(0).startOffse t,
38 "After removeAllRanges(), addRange() must be forwards, so anchorOffs et must equal startOffset rather than endOffset");
39 assert_equals(selection.focusOffset, selection.getRangeAt(0).endOffset,
40 "After removeAllRanges(), addRange() must be forwards, so focusOffse t must equal endOffset rather than startOffset");
41 }, "Range " + i + " " + testRanges[i] + " backwards");
42 }
43
44 testDiv.style.display = "none";
45 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698