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

Unified 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-26T17:13:06 Created 4 years, 2 months 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..dd4f1901e19a1629527e9a0304932821f7737d1c 100644
--- a/third_party/WebKit/LayoutTests/editing/execCommand/remove-formatting.html
+++ b/third_party/WebKit/LayoutTests/editing/execCommand/remove-formatting.html
@@ -1,41 +1,49 @@
-<!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'),
+ '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');
+test(() => assert_selection(
+ [
+ '<div contenteditable>',
+ '<b>^abc</b>',
+ '<a href="#foo">def</a>',
+ '<i>ghi</i><br>',
+ '<table><tbody><tr><td>one</td><td>two</td></tr></tbody></table>',
+ '<u>jkl</u>',
+ 'mno',
+ '<span style="text-decoration:line-through">baz|</span><br>',
+ '</div>',
+ ].join(''),
+ 'removeFormat',
+ [
+ '<div contenteditable>',
+ '^abc',
+ '<a href="#foo">def</a>',
+ 'ghi<br>',
+ '<table><tbody><tr><td>one</td><td>two</td></tr></tbody></table>',
+ 'jkl',
+ 'mno',
+ 'baz|<br>',
+ '</div>',
+ ].join('')),
+ 'RemoveFormat command with range selection');
</script>
-</body>
-</html>
« 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