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

Side by Side Diff: third_party/WebKit/LayoutTests/editing/execCommand/remove-formatting.html

Issue 2452003002: Convert editing/deleting/remove-formatting.html to utilize w3c test harness (Closed)
Patch Set: 2016-10-26T15:40:38 Created 4 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/editing/execCommand/remove-formatting-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!doctype html>
2 <html> 2 <script src="../../resources/testharness.js"></script>
3 <body> 3 <script src="../../resources/testharnessreport.js"></script>
4 <script src="../../resources/dump-as-markup.js"></script> 4 <script src="../assert_selection.js"></script>
5 <div id="test" contenteditable="true">
6 <b>foo</b><a href="http://www.google.com/">bar</a><i>baz</i><br>
7 <table border="1"><tr><td>foo</td><td>bar</td><td>baz</td></tr></table>
8 <u>foo</u>bar<span style="text-decoration:line-through">baz</span><br>
9 </div>
10 <pre id="console"></pre>
11 <script> 5 <script>
6 test(() => assert_selection(
7 '<div contenteditable><a href="http://foo">bar</a></div>',
8 selection => {
9 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
10 'RemoveFormat enabled with no selection');
11 },
12 '<div contenteditable><a href="http://foo">bar</a></div>'),
13 'RemoveFormat command with no selection');
12 14
13 if (window.testRunner) 15 test(() => assert_selection(
14 testRunner.dumpEditingCallbacks(); 16 '<div contenteditable><b>abc</b></div>',
17 selection => {
18 assert_false(selection.document.execCommand('removeFormat'),
19 'RemoveFormat enabled with no selection');
20 },
21 '<div contenteditable><b>abc</b></div>'),
22 '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.
15 23
16 function log(message) { 24 test(() => assert_selection(
17 var console = document.getElementById("console"); 25 [
18 console.innerHTML += message + '\n'; 26 '<div contenteditable>',
19 } 27 '<b>^abc</b>',
20 28 '<a href="#foo">def</a>',
21 var e = document.getElementById("test"); 29 '<i>ghi</i>',
22 var s = window.getSelection(); 30 '<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
23 31 '<u>jkl</u>',
24 if (document.queryCommandEnabled("RemoveFormat")) 32 '<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.
25 log("Failure: RemoveFormat enabled with no selection."); 33 ].join(''),
26 s.collapse(e, 0); 34 'removeFormat',
27 if (document.queryCommandEnabled("RemoveFormat")) 35 [
28 log("Failure: RemoveFormat enabled with a caret selection."); 36 '<div contenteditable>',
29 document.execCommand("SelectAll"); 37 '^abc',
30 if (!document.queryCommandEnabled("RemoveFormat")) 38 '<a href="#foo">def</a>',
31 log("Failure: RemoveFormat disabled with an editable selection."); 39 'ghi',
32 if (!document.execCommand("RemoveFormat")) 40 '<table><tbody><tr><td>one</td><td>two</td></tr></tbody></table>',
33 log("Failure: execCommand('RemoveFormat') returned false."); 41 'jkl',
34 42 'baz|',
35 Markup.description('This is a test for execCommand("RemoveFormat"). It demonstra tes a bug: everything in the editable region below should be selected, as everyt hing was selected before Remove Format was performed.'); 43 '</div>',
36 Markup.dump(e, 'markup'); 44 ].join('')),
37 Markup.dump('console', 'console'); 45 'RemoveFormat command with range selection');
38
39 </script> 46 </script>
40 </body>
41 </html>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/editing/execCommand/remove-formatting-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698