Index: LayoutTests/editing/selection/deleteFromDocument.html |
diff --git a/LayoutTests/editing/selection/deleteFromDocument.html b/LayoutTests/editing/selection/deleteFromDocument.html |
index 1a94a20eb655f8e2d822d027ebea1d2a3bcd3045..d9b09e81ccde8192959a9f457f2723c099b7f571 100644 |
--- a/LayoutTests/editing/selection/deleteFromDocument.html |
+++ b/LayoutTests/editing/selection/deleteFromDocument.html |
@@ -1,7 +1,9 @@ |
<html> |
+<head> |
+<script src="../../resources/js-test.js"></script> |
+</head> |
<body> |
<div id="test"><span id="span1">foo<span id="span2">bar</span></span><span id="span3">baz</span></div> |
-<div id="console"></div> |
<script> |
var s = window.getSelection(); |
var testDiv = document.getElementById("test"); |
@@ -9,23 +11,6 @@ var span1 = document.getElementById("span1"); |
var span2 = document.getElementById("span2"); |
var span3 = document.getElementById("span3"); |
-function log(str) { |
- var li = document.createElement("li"); |
- li.appendChild(document.createTextNode(str)); |
- document.getElementById("console").appendChild(li); |
-} |
- |
-function shouldBe(expr, expected) { |
- var actual = eval(expr); |
- if (actual != expected) |
- log("Failure: " + expr + " should be " + expected + ", was " + actual + "."); |
- else |
- log("Success: " + expr + " is " + expected + "."); |
-} |
- |
-if (window.testRunner) |
- testRunner.dumpAsText(); |
- |
var r = document.createRange(); |
@@ -35,14 +20,7 @@ r.setEnd(span2.firstChild, 1); |
s.addRange(r); |
s.deleteFromDocument() |
-shouldBe('span1.textContent', 'fooar'); |
-try { |
- s.deleteFromDocument() |
- shouldBe('span1.textContent', 'foar'); |
-} catch (ex) { |
- log(ex); |
-} |
- |
+shouldBeEqualToString("span1.textContent", "foobar"); |
// try to delete a collapsed selection at the start |
r.setStart(span1.firstChild, 0); |
@@ -50,24 +28,19 @@ r.setEnd(span1.firstChild, 0); |
s.removeAllRanges(); |
s.addRange(r); |
-try { |
- s.deleteFromDocument() |
- shouldBe('span1.textContent', 'foar'); |
-} catch (ex) { |
- log(ex); |
-} |
+s.deleteFromDocument() |
+shouldBeEqualToString("span1.textContent", "foobar"); |
// delete whole contents |
r.setStart(span2.firstChild, 0); |
-r.setEnd(span2.firstChild, 2); |
+r.setEnd(span2.firstChild, 3); |
s.removeAllRanges(); |
s.addRange(r); |
s.deleteFromDocument() |
-shouldBe('span1.firstChild.nextSibling.id', 'span2'); |
-shouldBe('span1.firstChild.nextSibling.firstChild.nodeValue', ''); |
- |
+shouldBeEqualToString("span1.firstChild.nextSibling.id", "span2"); |
+shouldBeEqualToString("span1.firstChild.nextSibling.firstChild.nodeValue", ""); |
// partially delete two nodes |
r.setStart(span1.firstChild, 1); |
@@ -76,7 +49,7 @@ s.removeAllRanges(); |
s.addRange(r); |
s.deleteFromDocument() |
-shouldBe('test.textContent', 'fz'); |
+shouldBeEqualToString("test.textContent", "fz"); |
</script> |
</body> |