Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / editing / execCommand / queryCommandState-02.html
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>
14
15 <script type="text/javascript">
16
17 if (window.testRunner) {
18     testRunner.dumpAsText();
19 }
20 var elem = document.getElementById("e");
21 var selection = window.getSelection();
22 selection.collapse(elem, 0);
23
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"));
34
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);
40 }
41
42 function assert(bool) {
43     if (!bool)
44         log("Failure");
45     else
46         log("Success");
47 }
48 </script>
49 </body>
50 </html>