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

Side by Side Diff: LayoutTests/editing/spelling/spellcheck-editable-on-focus-multiframe.html

Issue 21694005: Spell check whole content of an editable element when it gets focused. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: style & spurious comment removal. Created 7 years, 4 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
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="resources/util.js"></script>
5 <script src="../../fast/js/resources/js-test-pre.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>
11
12 <script>
13
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 e ditables. " +
18 "Mispelling should be marked again");
19
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.";
30
31 if (window.internals) {
32 internals.settings.setUnifiedTextCheckerEnabled(true);
33 internals.settings.setAsynchronousSpellCheckingEnabled(false);
34 internals.setContinuousSpellCheckingEnabled(true);
35
36 shouldBe('internals.markerCountForNode(testEditable1.childNodes[0], "spellin g")', '0');
37 shouldBe('internals.markerCountForNode(testEditable2.childNodes[0], "spellin g")', '0');
38 testEditable1.focus();
39 shouldBe('internals.markerCountForNode(testEditable1.childNodes[0], "spellin g")', '3');
40 testEditable2.focus();
41 shouldBe('internals.markerCountForNode(testEditable1.childNodes[0], "spellin g")', '3');
42 internals.setContinuousSpellCheckingEnabled(false);
43 shouldBe('internals.markerCountForNode(testEditable1.childNodes[0], "spellin g")', '0');
44 shouldBe('internals.markerCountForNode(testEditable2.childNodes[0], "spellin g")', '0');
45 internals.setContinuousSpellCheckingEnabled(true);
46 testEditable1.focus();
47 testEditable2.focus();
48 shouldBe('internals.markerCountForNode(testEditable1.childNodes[0], "spellin g")', '3');
49 shouldBe('internals.markerCountForNode(testEditable2.childNodes[0], "spellin g")', '3');
50 } else {
51 log("Automatic testing impossible. Test manually. See steps in the descripti on.");
52 }
53 </script>
54 <script src="../../fast/js/resources/js-test-post.js"></script>
55 </body>
56 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698