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

Unified Diff: third_party/WebKit/LayoutTests/fast/dom/Range/range-exceptions.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-exceptions.html
diff --git a/third_party/WebKit/LayoutTests/fast/dom/Range/range-exceptions.html b/third_party/WebKit/LayoutTests/fast/dom/Range/range-exceptions.html
index a0984d63c66ece555d93129fc16ff972754b6058..deee2328198abe40e9cca5212996759643f08cfd 100644
--- a/third_party/WebKit/LayoutTests/fast/dom/Range/range-exceptions.html
+++ b/third_party/WebKit/LayoutTests/fast/dom/Range/range-exceptions.html
@@ -4,6 +4,31 @@
<script src="../../../resources/js-test.js"></script>
</head>
<body>
-<script src="script-tests/range-exceptions.js"></script>
+<script>
+description(
+"This test checks some DOM Range exceptions."
+);
+
+// Test to be sure the name BAD_BOUNDARYPOINTS_ERR dumps properly.
+var node = document.createElement("DIV");
+node.innerHTML = "<BAR>AB<MOO>C</MOO>DE</BAR>";
+shouldBe("node.innerHTML", "'<bar>AB<moo>C</moo>DE</bar>'");
+
+// Ensure that we throw BAD_BOUNDARYPOINTS_ERR when trying to split a comment
+// (non-text but character-offset node). (Test adapted from Acid3.)
+var c1 = document.createComment("aaaaa");
+node.appendChild(c1);
+var c2 = document.createComment("bbbbb");
+node.appendChild(c2);
+var r = document.createRange();
+r.setStart(c1, 2);
+r.setEnd(c2, 3);
+shouldThrow("r.surroundContents(document.createElement('a'))", '"InvalidStateError: Failed to execute \'surroundContents\' on \'Range\': The Range has partially selected a non-Text node."');
+
+// But not when we don't try to split the comment.
+r.setStart(c1, 0);
+r.setEnd(c1, 5);
+shouldThrow("r.surroundContents(document.createElement('a'))", '"HierarchyRequestError: Failed to execute \'surroundContents\' on \'Range\': The node to be inserted is a \'A\' node, which may not be inserted here."');
+</script>
</body>
</html>

Powered by Google App Engine
This is Rietveld 408576698