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

Unified Diff: third_party/WebKit/LayoutTests/editing/execCommand/queryCommandState-01.html

Issue 2342513002: Convert editing/execCommand/queryCommandState-01.html to use w3c test harness (Closed)
Patch Set: 2016-09-14T13:15:40 Created 4 years, 3 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/queryCommandState-01-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/queryCommandState-01.html
diff --git a/third_party/WebKit/LayoutTests/editing/execCommand/queryCommandState-01.html b/third_party/WebKit/LayoutTests/editing/execCommand/queryCommandState-01.html
index b7e7b044b0e76283bd508a4551dd3c3df71cb823..4c2658c111c6a9f080ea256524f350b709139e56 100644
--- a/third_party/WebKit/LayoutTests/editing/execCommand/queryCommandState-01.html
+++ b/third_party/WebKit/LayoutTests/editing/execCommand/queryCommandState-01.html
@@ -1,44 +1,21 @@
-<head>
+<!doctype html>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script src="../assert_selection.js"></script>
+<div contenteditable id="sample">foo</div>
<script>
-if (window.testRunner)
- testRunner.dumpEditingCallbacks();
+test(() => {
+ const sample = document.getElementById('sample');
+ const selection = window.getSelection();
+ selection.collapse(sample, 0);
+ assert_false(document.queryCommandState('insertUnorderedList'), '1 InsertUnorderedList');
+ assert_false(document.queryCommandState('insertOrderedList'), '2 insertOrderedList');
+ document.execCommand('insertUnorderedList');
+ assert_true(document.queryCommandState('insertUnorderedList'), '3 insertUnorderedList');
+ assert_false(document.queryCommandState('insertOrderedList'), '4 insertOrderedList');
+ document.execCommand('insertUnorderedList');
+ document.execCommand('insertOrderedList');
+ assert_false(document.queryCommandState('insertUnorderedList'), '5 insertUnorderedList');
+ assert_true(document.queryCommandState('insertOrderedList'), '6 insertOrderedList');
+}, 'queryCommandState for InsertOrderedList/InsertUnorderedList');
</script>
-
-<script>
-function log(str) {
- var li = document.createElement("li");
- li.appendChild(document.createTextNode(str));
- var console = document.getElementById("console");
- console.appendChild(li);
-}
-
-function assert(bool) {
- if (!bool)
- log("Failure");
- else
- log("Success");
-}
-</script>
-</head>
-<body>
-<p>This tests queryCommandState for InsertUnorderedList and InsertOrderedList.</p>
-<div id="div" contenteditable="true">foo</div>
-<ol id="console"></ol>
-<script>
-if (window.testRunner)
- window.testRunner.dumpAsText();
-var sel = window.getSelection();
-var div = document.getElementById("div");
-sel.collapse(div, 0);
-
-assert(!document.queryCommandState("InsertUnorderedList"));
-assert(!document.queryCommandState("InsertOrderedList"));
-document.execCommand("InsertUnorderedList");
-assert(document.queryCommandState("InsertUnorderedList"));
-assert(!document.queryCommandState("InsertOrderedList"));
-document.execCommand("InsertUnorderedList");
-document.execCommand("InsertOrderedList");
-assert(!document.queryCommandState("InsertUnorderedList"));
-assert(document.queryCommandState("InsertOrderedList"));
-</script>
-</body>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/editing/execCommand/queryCommandState-01-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698