git-svn-id: https://svn.webkit.org/repository/webkit/trunk@17235 268f45cc-cd09-0410...
[WebKit-https.git] / LayoutTests / editing / execCommand / queryCommandState-01.html
1 <head>
2 <script>
3 function log(str) {
4     var li = document.createElement("li");
5     li.appendChild(document.createTextNode(str));
6     var console = document.getElementById("console");
7     console.appendChild(li);
8 }
9
10 function assert(bool) {
11     if (!bool)
12         log("Failure");
13     else
14         log("Success");
15 }
16 </script>
17 </head>
18 <body>
19 <p>This tests queryCommandState for InsertUnorderedList and InsertOrderedList.</p>
20 <div id="div" contenteditable="true">foo</div>
21 <ol id="console"></ol>
22 <script>
23 if (window.layoutTestController)
24     window.layoutTestController.dumpAsText();
25 var sel = window.getSelection();
26 var div = document.getElementById("div");
27 sel.setPosition(div, 0);
28
29 assert(!document.queryCommandState("InsertUnorderedList"));
30 assert(!document.queryCommandState("InsertOrderedList"));
31 document.execCommand("InsertUnorderedList");
32 assert(document.queryCommandState("InsertUnorderedList"));
33 assert(!document.queryCommandState("InsertOrderedList"));
34 document.execCommand("InsertUnorderedList");
35 document.execCommand("InsertOrderedList");
36 assert(!document.queryCommandState("InsertUnorderedList"));
37 assert(document.queryCommandState("InsertOrderedList"));
38 </script>
39 </body>