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

Side by Side Diff: LayoutTests/editing/spelling/spellcheck-disable-enable.html

Issue 21130005: Trigger spell check/remove markers if spell checker gets enabled/disabled. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Revert paste related changes 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
« no previous file with comments | « no previous file | LayoutTests/editing/spelling/spellcheck-disable-enable-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../fast/js/resources/js-test-pre.js"></script>
5 </head>
6 <body onload="test(document.getElementById('destination'), document.getElementBy Id('frame').contentWindow.document);">
7 <pre id="console"></pre>
8 <div id="container">
9 <div id="destination" contentEditable></div>
10 <iframe id="frame" src="data:text/html,<body contenteditable></body>"></iframe >
11 </div>
12
13 <script>
14 description("Spell check markers should be removed from the whole page when disa bling spell checker but " +
15 "they should be restored in the focused editable if spell checker gets enabled. " +
16 "To test manually type something with mispellings in the above editable element and iframe and turn " +
17 "spell checker off - misspelling markers should disappear. Having the editable f ocused " +
18 "turn spell checker on again. Misspellings in the editable should be marked agai n.");
19
20 var destination_elm = null;
21 var destination_elm_in_frame = null;
22
23 function test(destination, frame_doc)
24 {
25 if (!window.internals)
26 {
27 document.getElementById("console").innerHTML = "Automatic testing imposs ible. Test manually.\n";
28 return;
29 }
30
31 internals.settings.setAsynchronousSpellCheckingEnabled(false);
32 internals.settings.setUnifiedTextCheckerEnabled(true);
33
34 function waitForMarkersToAppear(node, nretry)
35 {
36 if (nretry > 0 && !internals.markerCountForNode(node, "spelling")) {
37 window.setTimeout(function() { waitForMarkersToAppear(node, nretry - 1); }, 1);
38 }
39 }
40
41 destination_elm = destination;
42 destination_elm_in_frame = frame_doc.body;
43 destination_elm.focus();
44 document.execCommand("InsertText", false, "zz.");
45 waitForMarkersToAppear(destination_elm.childNodes[0], 10);
46 shouldBe('internals.markerCountForNode(destination_elm.childNodes[0], "spell ing")', '1');
47 destination_elm_in_frame.focus();
48 frame_doc.execCommand("InsertText", false, "zz.");
49 waitForMarkersToAppear(destination_elm_in_frame.childNodes[0], 10);
50 shouldBe('internals.markerCountForNode(destination_elm_in_frame.childNodes[0 ], "spelling")', '1');
51 internals.setContinuousSpellCheckingEnabled(false);
52 shouldBe('internals.markerCountForNode(destination_elm.childNodes[0], "spell ing")', '0');
53 shouldBe('internals.markerCountForNode(destination_elm_in_frame.childNodes[0 ], "spelling")', '0');
54 destination_elm.focus();
55 internals.setContinuousSpellCheckingEnabled(true);
56 waitForMarkersToAppear(destination_elm.childNodes[0], 10);
57 shouldBe('internals.markerCountForNode(destination_elm.childNodes[0], "spell ing")', '1');
58
59 }
60
61 </script>
62 <script src="../../fast/js/resources/js-test-post.js"></script>
63 </body>
64 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/editing/spelling/spellcheck-disable-enable-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698