Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / spelling / spellcheck-editable-on-focus-multiframe.html
blob67da4e2ea63914baf6de7feb31ee76c09f4a8673
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="resources/util.js"></script>
5 <script src="../../resources/js-test.js"></script>
6 </head>
7 <body>
8 <pre id="console"></pre>
9 <iframe id="frame1" src="data:text/html,<body></body>"></iframe>
10 <iframe id="frame2" src="data:text/html,<body></body>"></iframe>
12 <script>
14 description("Spell checking should be triggered on focus of an editable. " +
15 "Also after retarting spell checker. It applies to all frames." +
16 "To test manually type focus above editable. Misspellings in them " +
17 "should be marked on focus.Turn spell checker off and on again and again focus editables. " +
18 "Mispelling should be marked again");
20 var frame1 = document.getElementById("frame1");
21 var testEditable1 = frame1.contentWindow.document.createElement("div");
22 testEditable1.setAttribute("contentEditable", "true");
23 frame1.contentWindow.document.body.appendChild(testEditable1);
24 var frame2 = document.getElementById("frame2");
25 var testEditable2 = frame1.contentWindow.document.createElement("div");
26 testEditable2.setAttribute("contentEditable", "true");
27 frame2.contentWindow.document.body.appendChild(testEditable2);
28 testEditable1.innerText = "zz zz zz.";
29 testEditable2.innerText = "zz zz zz.";
31 if (window.internals) {
32 internals.settings.setUnifiedTextCheckerEnabled(true);
33 internals.settings.setAsynchronousSpellCheckingEnabled(false);
34 internals.setContinuousSpellCheckingEnabled(true);
36 shouldBe('internals.markerCountForNode(testEditable1.childNodes[0], "spelling")', '0');
37 shouldBe('internals.markerCountForNode(testEditable2.childNodes[0], "spelling")', '0');
38 testEditable1.focus();
39 shouldBe('internals.markerCountForNode(testEditable1.childNodes[0], "spelling")', '3');
40 testEditable2.focus();
41 shouldBe('internals.markerCountForNode(testEditable1.childNodes[0], "spelling")', '3');
42 internals.setContinuousSpellCheckingEnabled(false);
43 shouldBe('internals.markerCountForNode(testEditable1.childNodes[0], "spelling")', '0');
44 shouldBe('internals.markerCountForNode(testEditable2.childNodes[0], "spelling")', '0');
45 internals.setContinuousSpellCheckingEnabled(true);
46 testEditable1.focus();
47 testEditable2.focus();
48 shouldBe('internals.markerCountForNode(testEditable1.childNodes[0], "spelling")', '3');
49 shouldBe('internals.markerCountForNode(testEditable2.childNodes[0], "spelling")', '3');
50 } else {
51 log("Automatic testing impossible. Test manually. See steps in the description.");
53 </script>
54 </body>
55 </html>