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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/imported/wpt/selection/removeAllRanges.html
diff --git a/third_party/WebKit/LayoutTests/imported/wpt/selection/removeAllRanges.html b/third_party/WebKit/LayoutTests/imported/wpt/selection/removeAllRanges.html
new file mode 100644
index 0000000000000000000000000000000000000000..cc6b6925608470af573947e3081036a01408ca7d
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/imported/wpt/selection/removeAllRanges.html
@@ -0,0 +1,45 @@
+<!doctype html>
+<title>Selection.removeAllRanges() tests</title>
+<div id=log></div>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<script src=common.js></script>
+<script>
+"use strict";
+
+// Also test a selection with no ranges
+testRanges.unshift("[]");
+
+var range = rangeFromEndpoints([paras[0].firstChild, 0, paras[0].firstChild, 1]);
+
+for (var i = 0; i < testRanges.length; i++) {
+ test(function() {
+ setSelectionForwards(eval(testRanges[i]));
+ selection.removeAllRanges();
+ assert_equals(selection.rangeCount, 0,
+ "After removeAllRanges(), rangeCount must be 0");
+ // Test that it's forwards
+ selection.addRange(range);
+ assert_equals(selection.anchorOffset, selection.getRangeAt(0).startOffset,
+ "After removeAllRanges(), addRange() must be forwards, so anchorOffset must equal startOffset rather than endOffset");
+ assert_equals(selection.focusOffset, selection.getRangeAt(0).endOffset,
+ "After removeAllRanges(), addRange() must be forwards, so focusOffset must equal endOffset rather than startOffset");
+ }, "Range " + i + " " + testRanges[i] + " forwards");
+
+ // Copy-pasted from above
+ test(function() {
+ setSelectionBackwards(eval(testRanges[i]));
+ selection.removeAllRanges();
+ assert_equals(selection.rangeCount, 0,
+ "After removeAllRanges(), rangeCount must be 0");
+ // Test that it's forwards
+ selection.addRange(range);
+ assert_equals(selection.anchorOffset, selection.getRangeAt(0).startOffset,
+ "After removeAllRanges(), addRange() must be forwards, so anchorOffset must equal startOffset rather than endOffset");
+ assert_equals(selection.focusOffset, selection.getRangeAt(0).endOffset,
+ "After removeAllRanges(), addRange() must be forwards, so focusOffset must equal endOffset rather than startOffset");
+ }, "Range " + i + " " + testRanges[i] + " backwards");
+}
+
+testDiv.style.display = "none";
+</script>

Powered by Google App Engine
This is Rietveld 408576698