Index: LayoutTests/editing/selection/deleteFromDocument.html |
diff --git a/LayoutTests/editing/selection/deleteFromDocument.html b/LayoutTests/editing/selection/deleteFromDocument.html |
index 1a94a20eb655f8e2d822d027ebea1d2a3bcd3045..f274411a4feb9080b5429f567dfcb2a2ccea4e2d 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); |
-} |
- |
+shouldBe('span1.textContent', "'foobar'"); |
yosin_UTC9
2014/04/24 06:39:58
nit: Please use ShouldBeEqualToString(expr, string
yoichio
2014/04/24 07:05:55
Done.
|
// 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() |
+shouldBe('span1.textContent', "'foobar'"); |
yosin_UTC9
2014/04/24 06:39:58
nit: Please use ShouldBeEqualToString(expr, string
yoichio
2014/04/24 07:05:55
Done.
|
// 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', ''); |
- |
+shouldBe('span1.firstChild.nextSibling.id', "'span2'"); |
yosin_UTC9
2014/04/24 06:39:58
nit: Please use ShouldBeEqualToString(expr, string
yoichio
2014/04/24 07:05:55
Done.
|
+shouldBe('span1.firstChild.nextSibling.firstChild.nodeValue', "''"); |
yosin_UTC9
2014/04/24 06:39:58
nit: Please use ShouldBeEqualToString(expr, string
yoichio
2014/04/24 07:05:55
Done.
|
// partially delete two nodes |
r.setStart(span1.firstChild, 1); |
@@ -76,7 +49,7 @@ s.removeAllRanges(); |
s.addRange(r); |
s.deleteFromDocument() |
-shouldBe('test.textContent', 'fz'); |
+shouldBe('test.textContent', "'fz'"); |
yosin_UTC9
2014/04/24 06:39:58
nit: Please use ShouldBeEqualToString(expr, string
yoichio
2014/04/24 07:05:55
Done.
|
</script> |
</body> |