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

Side by Side Diff: third_party/WebKit/LayoutTests/editing/spelling/spellcheck-attribute-settings-default.html

Issue 2316303006: Make default spellchecking behavior in html elements configurable via WebSettings. (Closed)
Patch Set: fix expectations Created 4 years, 3 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 <html>
Rick Byers 2016/09/26 18:44:34 nit: html, head and body tags are normally omitted
timvolodine 2016/09/27 17:51:56 yes hmm, however it appears all spellcheck related
2 <head>
3 <title>Spellcheck Attribute Settings Default Test</title>
4 <script src="../editing.js"></script>
5 <script src="resources/util.js"></script>
6 <script src="../../resources/js-test.js"></script>
7 </head>
8 <body>
9 <div id="testRoot">
10 <label>1.1.</label><input id="test1_1" type="text"></input><br/>
11 <label>1.2.</label><input id="test1_2" type="text" spellcheck="true"></input><br />
12 <label>1.3.</label><input id="test1_3" type="text" spellcheck="false"></input><b r/>
13 <label>1.4.</label><input id="test1_4" type="text" spellcheck="InvalidValue"></i nput><br/>
14 <label>1.5.</label><input id="test1_5" type="text" spellcheck></input><br/>
15 </div>
16 <script>
17 description('This tests that the spellcheck default value is as specified in '
18 + 'internal blink settings. This allows embedders to specify spellchecking '
19 + 'behavior when the spellcheck attribute is not explicitly set.');
20
21 jsTestIsAsync = true;
22 if (window.testRunner)
23 testRunner.setMockSpellCheckerEnabled(true);
24
25 // Type misspelling to all input elements.
26 var inputs = document.getElementsByTagName('input');
27 for (var i = 0; i < inputs.length; i++)
28 typeText(inputs[i], 'zz ');
29
30 var shouldBeMarked;
31
32 function testMarkerForMisspelledWord(id, isMisspelled, enabled_by_default) {
33 if (!window.internals)
34 return done();
35
36 internals.settings.setSpellCheckEnabledByDefault(enabled_by_default);
37
38 var inputElement = document.getElementById(id);
39 // Spelling markers for input will appear if it's focused.
40 inputElement.focus();
41
42 debug("id=" + id + " type=" + inputElement.type + " spellcheck=" + inputElem ent.spellcheck + " enabled_by_default=" + enabled_by_default);
43
44 shouldBeMarked = isMisspelled;
45 shouldBecomeEqual('internals.hasSpellingMarker(document, 0, 2)', 'shouldBeMa rked', done);
46 }
47
48 var tests = [
49 // spellcheck enabled by default
50 function() { testMarkerForMisspelledWord('test1_1', true, true); },
51 function() { testMarkerForMisspelledWord('test1_2', true, true); },
52 function() { testMarkerForMisspelledWord('test1_3', false, true); },
53 function() { testMarkerForMisspelledWord('test1_4', true, true); },
54 function() { testMarkerForMisspelledWord('test1_5', true, true); },
55 // spellcheck disabled by default
56 function() { testMarkerForMisspelledWord('test1_1', false, false); },
57 function() { testMarkerForMisspelledWord('test1_2', true, false); },
58 function() { testMarkerForMisspelledWord('test1_3', false, false); },
59 function() { testMarkerForMisspelledWord('test1_4', false, false); },
60 function() { testMarkerForMisspelledWord('test1_5', false, false); },
61 ];
62
63 function done()
64 {
65 var next = tests.shift();
66 if (next)
67 return window.setTimeout(next, 0);
68
69 if (window.testRunner) {
70 // Cleaning up for expectation text if running on DRT.
71 document.getElementById("testRoot").style.display = "none";
72 }
73 finishJSTest();
74 }
75 done();
76
77 </script>
78 </body>
79 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698