Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/editing/execCommand/remove-formatting.html |
| diff --git a/third_party/WebKit/LayoutTests/editing/execCommand/remove-formatting.html b/third_party/WebKit/LayoutTests/editing/execCommand/remove-formatting.html |
| index 2b4517bc7aa4ac8c281875630367fd60b61a4ffe..d7d5fb94977ff9b6db2bb19177f98893ce53b69f 100644 |
| --- a/third_party/WebKit/LayoutTests/editing/execCommand/remove-formatting.html |
| +++ b/third_party/WebKit/LayoutTests/editing/execCommand/remove-formatting.html |
| @@ -1,41 +1,46 @@ |
| -<!DOCTYPE html> |
| -<html> |
| -<body> |
| -<script src="../../resources/dump-as-markup.js"></script> |
| -<div id="test" contenteditable="true"> |
| -<b>foo</b><a href="http://www.google.com/">bar</a><i>baz</i><br> |
| -<table border="1"><tr><td>foo</td><td>bar</td><td>baz</td></tr></table> |
| -<u>foo</u>bar<span style="text-decoration:line-through">baz</span><br> |
| -</div> |
| -<pre id="console"></pre> |
| +<!doctype html> |
| +<script src="../../resources/testharness.js"></script> |
| +<script src="../../resources/testharnessreport.js"></script> |
| +<script src="../assert_selection.js"></script> |
| <script> |
| +test(() => assert_selection( |
| + '<div contenteditable><a href="http://foo">bar</a></div>', |
| + selection => { |
| + assert_false(selection.document.execCommand('removeFormat'), |
|
Xiaocheng
2016/10/26 07:56:34
I think using queryCommandEnabled is better here.
yosin_UTC9
2016/10/26 08:16:39
This verifies return value of Document#execCommand
|
| + 'RemoveFormat enabled with no selection'); |
| + }, |
| + '<div contenteditable><a href="http://foo">bar</a></div>'), |
| + 'RemoveFormat command with no selection'); |
| -if (window.testRunner) |
| - testRunner.dumpEditingCallbacks(); |
| - |
| -function log(message) { |
| - var console = document.getElementById("console"); |
| - console.innerHTML += message + '\n'; |
| -} |
| - |
| -var e = document.getElementById("test"); |
| -var s = window.getSelection(); |
| - |
| -if (document.queryCommandEnabled("RemoveFormat")) |
| - log("Failure: RemoveFormat enabled with no selection."); |
| -s.collapse(e, 0); |
| -if (document.queryCommandEnabled("RemoveFormat")) |
| - log("Failure: RemoveFormat enabled with a caret selection."); |
| -document.execCommand("SelectAll"); |
| -if (!document.queryCommandEnabled("RemoveFormat")) |
| - log("Failure: RemoveFormat disabled with an editable selection."); |
| -if (!document.execCommand("RemoveFormat")) |
| - log("Failure: execCommand('RemoveFormat') returned false."); |
| - |
| -Markup.description('This is a test for execCommand("RemoveFormat"). It demonstrates a bug: everything in the editable region below should be selected, as everything was selected before Remove Format was performed.'); |
| -Markup.dump(e, 'markup'); |
| -Markup.dump('console', 'console'); |
| +test(() => assert_selection( |
| + '<div contenteditable><b>abc</b></div>', |
| + selection => { |
| + assert_false(selection.document.execCommand('removeFormat'), |
| + 'RemoveFormat enabled with no selection'); |
| + }, |
| + '<div contenteditable><b>abc</b></div>'), |
| + 'RemoveFormat command with caret'); |
|
Xiaocheng
2016/10/26 07:56:34
I don't understand this test. The title and the as
yosin_UTC9
2016/10/26 08:16:38
Oops, I forgot to set caret.
|
| +test(() => assert_selection( |
| + [ |
| + '<div contenteditable>', |
| + '<b>^abc</b>', |
| + '<a href="#foo">def</a>', |
| + '<i>ghi</i>', |
| + '<table><tbody><tr><td>one</td><td>two</td></tr></tbody></table>', |
|
Xiaocheng
2016/10/26 07:56:34
There's a <br> before <table> in the original test
yosin_UTC9
2016/10/26 08:16:38
<br> doesn't affect test. Anyway, I add <br> befor
|
| + '<u>jkl</u>', |
| + '<span style="text-decoration:line-through">baz|</span>', |
|
Xiaocheng
2016/10/26 07:56:34
There is some plain text between <u> and <span> in
yosin_UTC9
2016/10/26 08:16:38
I think it isn't significant. Anyway, I added.
|
| + ].join(''), |
| + 'removeFormat', |
| + [ |
| + '<div contenteditable>', |
| + '^abc', |
| + '<a href="#foo">def</a>', |
| + 'ghi', |
| + '<table><tbody><tr><td>one</td><td>two</td></tr></tbody></table>', |
| + 'jkl', |
| + 'baz|', |
| + '</div>', |
| + ].join('')), |
| + 'RemoveFormat command with range selection'); |
| </script> |
| -</body> |
| -</html> |