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

Side by Side Diff: LayoutTests/editing/spelling/script-tests/spelling-hasspellingmarker.js

Issue 204383002: Use asynchronous spellchecking in spelling-hasspellingmarker.js (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 9 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/spelling-hasspellingmarker.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 description('This tests internals.hasSpellingMarker works for differnt type of e lements.'); 1 description('This tests if internals.hasSpellingMarker works for differnt type o f elements. '
2 + 'This test succeds when there are four elements having "zz ". '
3 + 'However, only the last one should not contatin spelling marker.');
2 4
3 var parent = document.createElement("div"); 5 jsTestIsAsync = true;
4 document.body.appendChild(parent);
5 6
6 function hasMarked(markup) 7 if (window.internals) {
7 { 8 internals.settings.setUnifiedTextCheckerEnabled(true);
8 parent.innerHTML = markup; 9 internals.settings.setAsynchronousSpellCheckingEnabled(true);
9 document.getElementById('test').focus();
10 document.execCommand("InsertText", false, 'z');
11 document.execCommand("InsertText", false, 'z');
12 document.execCommand("InsertText", false, ' ');
13
14 return internals.hasSpellingMarker(document, 0, 2);
15 } 10 }
16 11
17 shouldBeTrue("hasMarked(\"<textarea id='test' cols='80' rows='10'></textarea>\") ;"); 12 var testRoot = document.createElement("div");
18 shouldBeTrue("hasMarked(\"<input id='test' type='text'>\");"); 13 document.body.insertBefore(testRoot, document.body.firstChild);
19 shouldBeTrue("hasMarked(\"<div id='test' contenteditable='true'></div>\");"); 14
20 shouldBeFalse("hasMarked(\"<div id='test' contentEditable='true' spellcheck='fal se'></div>\");"); 15 function addContainer(markup)
21 parent.innerHTML = ""; 16 {
17 var contatiner = document.createElement("div");
18 contatiner.innerHTML = markup;
19 testRoot.appendChild(contatiner);
20
21 return contatiner;
22 }
23
24 function typeMisspelling(contatiner)
25 {
26 contatiner.firstChild.focus();
27 typeCharacterCommand('z');
28 typeCharacterCommand('z');
29 typeCharacterCommand(' ');
30 }
31
32 function verifySpellingMarkers(element)
33 {
34 var div = addContainer(element.containerMarkup);
35 typeMisspelling(div);
36
37 if (window.internals)
38 shouldBecomeEqual("internals.hasSpellingMarker(document, 0, 2)", element .isMisspelled ? "true" : "false", done);
39 else
40 done();
41 }
42
43 var testCases = [
44 { containerMarkup: "<textarea></textarea>", isMisspelled: true },
45 { containerMarkup: "<input type='text'></input>", isMisspelled: true },
46 { containerMarkup: "<div contenteditable='true'></div>", isMisspelled: true },
47 { containerMarkup: "<div contentEditable='true' spellcheck='false'></div>", isMisspelled: false }
48 ];
49
50 function done()
51 {
52 var nextTestCase = testCases.shift();
53 if (nextTestCase)
54 return setTimeout(verifySpellingMarkers(nextTestCase), 0);
55
56 if (window.internals)
57 testRoot.style.display = "none";
58
59 finishJSTest();
60 }
61 done();
22 62
23 var successfullyParsed = true; 63 var successfullyParsed = true;
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/editing/spelling/spelling-hasspellingmarker.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698