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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <head> 1 <!doctype html>
2 <script src="../../resources/testharness.js"></script>
3 <script src="../../resources/testharnessreport.js"></script>
4 <script src="../assert_selection.js"></script>
5 <div contenteditable id="sample">foo</div>
2 <script> 6 <script>
3 if (window.testRunner) 7 test(() => {
4 testRunner.dumpEditingCallbacks(); 8 const sample = document.getElementById('sample');
9 const selection = window.getSelection();
10 selection.collapse(sample, 0);
11 assert_false(document.queryCommandState('insertUnorderedList'), '1 InsertUno rderedList');
12 assert_false(document.queryCommandState('insertOrderedList'), '2 insertOrder edList');
13 document.execCommand('insertUnorderedList');
14 assert_true(document.queryCommandState('insertUnorderedList'), '3 insertUnor deredList');
15 assert_false(document.queryCommandState('insertOrderedList'), '4 insertOrder edList');
16 document.execCommand('insertUnorderedList');
17 document.execCommand('insertOrderedList');
18 assert_false(document.queryCommandState('insertUnorderedList'), '5 insertUno rderedList');
19 assert_true(document.queryCommandState('insertOrderedList'), '6 insertOrdere dList');
20 }, 'queryCommandState for InsertOrderedList/InsertUnorderedList');
5 </script> 21 </script>
6
7 <script>
8 function log(str) {
9 var li = document.createElement("li");
10 li.appendChild(document.createTextNode(str));
11 var console = document.getElementById("console");
12 console.appendChild(li);
13 }
14
15 function assert(bool) {
16 if (!bool)
17 log("Failure");
18 else
19 log("Success");
20 }
21 </script>
22 </head>
23 <body>
24 <p>This tests queryCommandState for InsertUnorderedList and InsertOrderedList.</ p>
25 <div id="div" contenteditable="true">foo</div>
26 <ol id="console"></ol>
27 <script>
28 if (window.testRunner)
29 window.testRunner.dumpAsText();
30 var sel = window.getSelection();
31 var div = document.getElementById("div");
32 sel.collapse(div, 0);
33
34 assert(!document.queryCommandState("InsertUnorderedList"));
35 assert(!document.queryCommandState("InsertOrderedList"));
36 document.execCommand("InsertUnorderedList");
37 assert(document.queryCommandState("InsertUnorderedList"));
38 assert(!document.queryCommandState("InsertOrderedList"));
39 document.execCommand("InsertUnorderedList");
40 document.execCommand("InsertOrderedList");
41 assert(!document.queryCommandState("InsertUnorderedList"));
42 assert(document.queryCommandState("InsertOrderedList"));
43 </script>
44 </body>
OLDNEW
« 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