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

Unified Diff: third_party/WebKit/LayoutTests/fast/dom/Range/range-modifycontents.html

Issue 2667393002: Stop using script-tests in fast/dom/. (Closed)
Patch Set: . 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/fast/dom/Range/range-modifycontents.html
diff --git a/third_party/WebKit/LayoutTests/fast/dom/Range/range-modifycontents.html b/third_party/WebKit/LayoutTests/fast/dom/Range/range-modifycontents.html
index 35acb20416a710e4cb47af81b9d085e198fee778..6dad04c3e9c431a1f11a8adabffc69991457de86 100644
--- a/third_party/WebKit/LayoutTests/fast/dom/Range/range-modifycontents.html
+++ b/third_party/WebKit/LayoutTests/fast/dom/Range/range-modifycontents.html
@@ -4,6 +4,103 @@
<script src="../../../resources/js-test.js"></script>
</head>
<body>
-<script src="script-tests/range-modifycontents.js"></script>
+<script>
+description(
+"Test modification of contents of a range"
+);
+
+var r;
+
+// TEST 1: Initial values
+debug('<span>Start test 1</span>');
+var r = document.createRange();
+shouldBe("r.startOffset", "0");
+shouldBe("r.endOffset", "0");
+shouldBe("r.startContainer", "document");
+shouldBe("r.endContainer", "document");
+shouldBeTrue("r.collapsed");
+shouldBe("r.commonAncestorContainer", "document");
+
+// TEST 2: Insert a comment into the document
+debug('<span>Start test 2</span>');
+r.insertNode(document.createComment("test comment"));
+shouldBe("r.startOffset", "0");
+shouldBe("r.endOffset", "1");
+shouldBe("r.startContainer", "document");
+shouldBe("r.endContainer", "document");
+shouldBeFalse("r.collapsed");
+shouldBe("r.commonAncestorContainer", "document");
+
+// TEST 3: Remove the comment again
+debug('<span>Start test 3</span>');
+r.deleteContents();
+shouldBe("r.startOffset", "0");
+shouldBe("r.endOffset", "0");
+shouldBe("r.startContainer", "document");
+shouldBe("r.endContainer", "document");
+shouldBeTrue("r.collapsed");
+shouldBe("r.commonAncestorContainer", "document");
+
+// TEST 4: Insert a document fragment
+debug('<span>Start test 4</span>');
+var f = document.createDocumentFragment();
+var c = document.getElementById("description");
+r.setStart(c, 0);
+f.appendChild(document.createTextNode("test text node"));
+f.appendChild(document.createComment("another text comment"));
+f.appendChild(document.createTextNode("another test text node"));
+r.insertNode(f);
+shouldBe("r.startOffset", "0");
+shouldBe("r.endOffset", "3");
+shouldBe("r.startContainer", "c");
+shouldBe("r.endContainer", "c");
+shouldBeFalse("r.collapsed");
+shouldBe("r.commonAncestorContainer", "c");
+
+// TEST 5: Remove the fragment again
+debug('<span>Start test 5</span>');
+r.deleteContents();
+shouldBe("r.startOffset", "0");
+shouldBe("r.endOffset", "0");
+shouldBe("r.startContainer", "c");
+shouldBe("r.endContainer", "c");
+shouldBeTrue("r.collapsed");
+shouldBe("r.commonAncestorContainer", "c");
+
+// TEST 6: Insert an empty document fragment
+debug('<span>Start test 6</span>');
+f = document.createDocumentFragment();
+r.insertNode(f);
+shouldBe("r.startOffset", "0");
+shouldBe("r.endOffset", "0");
+shouldBe("r.startContainer", "c");
+shouldBe("r.endContainer", "c");
+shouldBeTrue("r.collapsed");
+shouldBe("r.commonAncestorContainer", "c");
+
+// TEST 7: Insert a div
+debug('<span>Start test 7</span>');
+var d = document.createElement("div");
+d.appendChild(document.createTextNode("test text node"));
+d.appendChild(document.createComment("another text comment"));
+d.appendChild(document.createTextNode("another test text node"));
+r.insertNode(d);
+shouldBe("r.startOffset", "0");
+shouldBe("r.endOffset", "1");
+shouldBe("r.startContainer", "c");
+shouldBe("r.endContainer", "c");
+shouldBeFalse("r.collapsed");
+shouldBe("r.commonAncestorContainer", "c");
+
+// TEST 8: Remove the div
+debug('<span>Start test 8</span>');
+r.deleteContents();
+shouldBe("r.startOffset", "0");
+shouldBe("r.endOffset", "0");
+shouldBe("r.startContainer", "c");
+shouldBe("r.endContainer", "c");
+shouldBeTrue("r.collapsed");
+shouldBe("r.commonAncestorContainer", "c");
+</script>
</body>
</html>

Powered by Google App Engine
This is Rietveld 408576698