Index: third_party/WebKit/LayoutTests/editing/execCommand/unlink.html |
diff --git a/third_party/WebKit/LayoutTests/editing/execCommand/unlink.html b/third_party/WebKit/LayoutTests/editing/execCommand/unlink.html |
index c48c9863de2e017f1179428758bf747d8a66ccb2..311d5427fd77fd152b99980fd616441bd4cc45af 100644 |
--- a/third_party/WebKit/LayoutTests/editing/execCommand/unlink.html |
+++ b/third_party/WebKit/LayoutTests/editing/execCommand/unlink.html |
@@ -1,94 +1,44 @@ |
-<html> |
-<head> |
-<script src=../editing.js language="JavaScript" type="text/JavaScript"></script> |
+<!doctype html> |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
+<script src="../assert_selection.js"></script> |
+<div id="log"></div> |
<script> |
-function log(message) { |
- var console = document.getElementById("console"); |
- var li = document.createElement("li"); |
- var text = document.createTextNode(message); |
- li.appendChild(text); |
- console.appendChild(li); |
-} |
+test(() => { |
+ assert_selection( |
+ '<div contenteditable><a href="abc">^0123456789|</a></div>', |
+ 'unlink', |
+ '<div contenteditable>^0123456789|</div>', |
+ 'Fully Select A element'); |
-function editingTest() { |
- |
- var s = window.getSelection(); |
- var d; |
- |
- if (window.testRunner) |
- window.testRunner.dumpAsText(); |
- |
- // Fully select the line in the first div. |
- d = document.getElementById("test1"); |
- s.collapse(d, 0); |
- extendSelectionForwardByLineCommand(); |
- unlinkCommand(); |
- |
- log(d.innerHTML); |
+ assert_selection( |
+ '<div contenteditable><a href="abc">012^345|6789</a></div>', |
+ 'unlink', |
+ '<div contenteditable><a href="abc">012</a>^345|<a href="abc">6789</a></div>', |
+ 'Partially Select A element'); |
- // Select the second word in the second div |
- d = document.getElementById("test2"); |
- s.collapse(d, 0); |
- moveSelectionForwardByWordCommand(); |
- extendSelectionForwardByWordCommand(); |
- unlinkCommand(); |
- |
- log(d.innerHTML); |
- |
- // Select part of a link (and a bit of trailing non-linked text) |
- d = document.getElementById("test3"); |
- var e = document.getElementById("test3start"); |
- s.collapse(e, 0); |
- extendSelectionForwardByLineCommand(); |
- unlinkCommand(); |
- |
- log(d.innerHTML); |
- |
- // Link an editable region containing lists, tables, images, etc. |
- d = document.getElementById("test4"); |
- s.collapse(d, 0); |
- selectAllCommand(); |
- createLinkCommand("http://www.google.com/"); |
- // Now unlink a portion of it |
- var end = document.getElementById("test4end"); |
- s.setBaseAndExtent(d, 0, end, 0); |
- unlinkCommand(); |
- |
- log(d.innerHTML); |
- |
-} |
-</script> |
-</head> |
+ assert_selection( |
+ '<div contenteditable><a href="abc">0123456^789</a>xy|z</div>', |
+ 'unlink', |
+ '<div contenteditable><a href=\"abc\">0123456</a>^789xy|z</div>', |
+ 'Partially Select A element and following test'); |
-<body style="font-size: 12px;"> |
-<p>This is a test of execCommand("Unlink"). It tests:</p> |
-<ol> |
-<li>Completely unlinking a link.</li> |
-<li>Unlinking a single word inside of a link.</li> |
-<li>Unlinking a selection containing linked and unlinked text.</li> |
-<li>Unlinking a selection that partially selects a linked table.</li> |
-</ol> |
-<p>The editable regions below describe what their content should be after the test.</p> |
-<ol> |
-<li><div id="test1" contenteditable="true"><a href="http://www.apple.com/">This paragraph should should end up unlinked.</a></div></li> |
-<li><div id="test2" contenteditable="true"><a href="http://www.apple.com/">The second word in this paragraph should end up being unlinked, everything else should be a link.</a></div></li> |
-<li><div id="test3" contenteditable="true">This paragraph starts with <a href="http://www.google.com"><i>a</i><span id="test3start"> link</span></a> in the middle. Only the 'a' in the previous sentence should be linked after the test.</div></li> |
-<li><div id="test4" contenteditable="true"> |
-<p>This <i>editable region</i> contains lists, tables, styled text, and images. Everything in this region that is not selected should be a link, nothing that is selected should be a link.</p> |
-<ul> |
-<li>Item 1</li> |
-<li>Item 2</li> |
-</ul> |
-<table border=1><tr><td>1</td><td>2</td><td><span id="test4end">3</span></td></tr></table> |
-<br> |
-This <b>line</b> contains <img src="../resources/abe.png"> an image. |
-</div></li> |
-</ol> |
-<p>The innerHTML of editable regions after the test:</p> |
-<ol id="console"></ol> |
-<script> |
-runEditingTest(); |
-</script> |
-</body> |
+ assert_selection( |
+ '<div contenteditable><a href="abc">^<img src="../resources/abe.png">|</a></div>', |
+ 'unlink', |
+ '^<div contenteditable><img src="../resources/abe.png"></div>', |
yoichio
2016/05/27 09:14:39
It is not '<div contenteditable>^<img src="../reso
yosin_UTC9
2016/05/27 09:54:17
Good catch! fixed along with fixing of assert_sele
|
+ 'Select image in a link'); |
-</html> |
+ assert_selection( |
+ '<div contenteditable>^<ul><li><a href="1">1</a></li><li><a href="2">2</a></li></ul>|</div>', |
+ 'unlink', |
+ '<div contenteditable><ul><li>^1</li><li>2|</li></ul></div>', |
+ 'Select a list'); |
+ |
+ assert_selection( |
+ '<div contenteditable><table><tr><td><a href="1">^1</a></td><td><a href="2">2|</a></td></tr></table></div>', |
+ 'unlink', |
+ '<div contenteditable><table><tbody><tr><td>^1</td><td>2|</td></tr></tbody></table></div>', |
+ 'Select a table'); |
+}); |
+</script> |