Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / execCommand / queryCommandState-02.html
blob1f6a4cc7bfd53cc6f4cb61f81623a3fb5162d084
1 <html>
2 <body>
3 This tests queryCommandState.
4 <p>
5 <a href="https://bugs.webkit.org/show_bug.cgi?id=32285">Bug 32285</a>
6 <br>
7 <a href="rdar://problem/7442387"> Radar 7442065</a>
8 </p>
9 <div id="e" contenteditable="true">
10 one
11 <div>two</div>
12 </div>
13 <ul id="console"></ul>
15 <script type="text/javascript">
17 if (window.testRunner) {
18 testRunner.dumpAsText();
20 var elem = document.getElementById("e");
21 var selection = window.getSelection();
22 selection.collapse(elem, 0);
24 document.execCommand("SelectAll");
25 document.execCommand("Bold");
26 assert(document.queryCommandState("Bold"));
27 assert(!document.queryCommandState("Italic"));
28 document.execCommand("Italic");
29 assert(document.queryCommandState("Bold"));
30 assert(document.queryCommandState("Italic"));
31 document.execCommand("Bold", false);
32 assert(!document.queryCommandState("Bold"));
33 assert(document.queryCommandState("Italic"));
35 function log(str) {
36 var li = document.createElement("li");
37 li.appendChild(document.createTextNode(str));
38 var console = document.getElementById("console");
39 console.appendChild(li);
42 function assert(bool) {
43 if (!bool)
44 log("Failure");
45 else
46 log("Success");
48 </script>
49 </body>
50 </html>