OLD | NEW |
---|---|
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <title>Spellcheck Attribute Test</title> | 3 <title>Spellcheck Attribute Test</title> |
4 <link rel="help" href="http://damowmow.com/playground/spellcheck.txt"> | 4 <link rel="help" href="http://damowmow.com/playground/spellcheck.txt"> |
5 <script src="../editing.js"></script> | |
6 <script src="resources/util.js"></script> | |
5 <script src="../../resources/js-test.js"></script> | 7 <script src="../../resources/js-test.js"></script> |
6 </head> | 8 </head> |
7 <body> | 9 <body> |
8 <p>This tests if the "spellcheck" attribute is implemented as written in its spe cification. If this test succeeds, you can see forms filled with an invalid word 'zz '. Nevertheless, the 'zz ' is not marked as misspelled in all of them. | |
9 <div id="testRoot"> | 10 <div id="testRoot"> |
10 | 11 |
11 <div spellcheck="true"> | 12 <div spellcheck="true"> |
12 <label>1.1.</label><input id="test1_1" type="text"></input><br/> | 13 <label>1.1.</label><input id="test1_1" type="text"></input><br/> |
13 <label>1.2.</label><input id="test1_2" type="text" spellcheck="true"></input><br /> | 14 <label>1.2.</label><input id="test1_2" type="text" spellcheck="true"></input><br /> |
14 <label>1.3.</label><input id="test1_3" type="text" spellcheck="false"></input><b r/> | 15 <label>1.3.</label><input id="test1_3" type="text" spellcheck="false"></input><b r/> |
15 <label>1.4.</label><input id="test1_4" type="text" spellcheck="InvalidValue"></i nput><br/> | 16 <label>1.4.</label><input id="test1_4" type="text" spellcheck="InvalidValue"></i nput><br/> |
16 <label>1.5.</label><input id="test1_5" type="text" spellcheck></input><br/> | 17 <label>1.5.</label><input id="test1_5" type="text" spellcheck></input><br/> |
17 <label>1.6.</label><input id="test1_6" type="text"></input><br/> | 18 <label>1.6.</label><input id="test1_6" type="text"></input><br/> |
groby-ooo-7-16
2013/11/08 19:25:13
I might be missing something, but isn't test x_6 t
grzegorz
2013/11/12 09:24:46
Good catch! Removed them at patch set #2.
| |
18 </div> | 19 </div> |
19 <div spellcheck="false"> | 20 <div spellcheck="false"> |
20 <label>2.1.</label><input id="test2_1" type="text"></input><br/> | 21 <label>2.1.</label><input id="test2_1" type="text"></input><br/> |
21 <label>2.2.</label><input id="test2_2" type="text" spellcheck="true"></input><br /> | 22 <label>2.2.</label><input id="test2_2" type="text" spellcheck="true"></input><br /> |
22 <label>2.3.</label><input id="test2_3" type="text" spellcheck="false"></input><b r/> | 23 <label>2.3.</label><input id="test2_3" type="text" spellcheck="false"></input><b r/> |
23 <label>2.4.</label><input id="test2_4" type="text" spellcheck="InvalidValue"></i nput><br/> | 24 <label>2.4.</label><input id="test2_4" type="text" spellcheck="InvalidValue"></i nput><br/> |
24 <label>2.5.</label><input id="test2_5" type="text" spellcheck></input><br/> | 25 <label>2.5.</label><input id="test2_5" type="text" spellcheck></input><br/> |
25 <label>2.6.</label><input id="test2_6" type="text"></input><br/> | 26 <label>2.6.</label><input id="test2_6" type="text"></input><br/> |
26 </div> | 27 </div> |
27 | 28 |
28 <div spellcheck="true"> | 29 <div spellcheck="true"> |
29 <label>3.1.</label><input id="test3_1" type="search"></input><br/> | 30 <label>3.1.</label><input id="test3_1" type="search"></input><br/> |
30 <label>3.2.</label><input id="test3_2" type="search" spellcheck="true"></input>< br/> | 31 <label>3.2.</label><input id="test3_2" type="search" spellcheck="true"></input>< br/> |
31 <label>3.3.</label><input id="test3_3" type="search" spellcheck="false"></input> <br/> | 32 <label>3.3.</label><input id="test3_3" type="search" spellcheck="false"></input> <br/> |
32 <label>3.4.</label><input id="test3_4" type="search" spellcheck="InvalidValue">< /input><br/> | 33 <label>3.4.</label><input id="test3_4" type="search" spellcheck="InvalidValue">< /input><br/> |
33 <label>3.5.</label><input id="test3_5" type="search" spellcheck></input><br/> | 34 <label>3.5.</label><input id="test3_5" type="search" spellcheck></input><br/> |
34 <label>3.6.</label><input id="test3_6" type="search"></input><br/> | 35 <label>3.6.</label><input id="test3_6" type="search"></input><br/> |
35 </div> | 36 </div> |
36 <div spellcheck="false"> | 37 <div spellcheck="false"> |
37 <label>4.1.</label><input id="test4_1" type="search"></input><br/> | 38 <label>4.1.</label><input id="test4_1" type="search"></input><br/> |
38 <label>4.2.</label><input id="test4_2" type="search" spellcheck="true"></input>< br/> | 39 <label>4.2.</label><input id="test4_2" type="search" spellcheck="true"></input>< br/> |
39 <label>4.3.</label><input id="test4_3" type="search" spellcheck="false"></input> <br/> | 40 <label>4.3.</label><input id="test4_3" type="search" spellcheck="false"></input> <br/> |
40 <label>4.4.</label><input id="test4_4" type="search" spellcheck="InvalidValue">< /input><br/> | 41 <label>4.4.</label><input id="test4_4" type="search" spellcheck="InvalidValue">< /input><br/> |
41 <label>4.5.</label><input id="test4_5" type="search" spellcheck></input><br/> | 42 <label>4.5.</label><input id="test4_5" type="search" spellcheck></input><br/> |
42 <label>4.6.</label><input id="test4_6" type="search"></input><br/> | 43 <label>4.6.</label><input id="test4_6" type="search"></input><br/> |
43 </div> | 44 </div> |
44 | 45 |
45 </div> | 46 </div> |
46 <pre id="console"></pre> | |
47 <script> | 47 <script> |
48 function log(msg) { | 48 description('This tests if the "spellcheck" attribute is implemented ' |
49 document.getElementById("console").innerHTML += (msg + "\n"); | 49 + 'as written in its specification. If this test succeeds, you can see ' |
50 + 'forms filled with an invalid word "zz". Nevertheless, the "zz" is not ' | |
51 + 'marked as misspelled in all of them.'); | |
52 | |
53 jsTestIsAsync = true; | |
54 | |
55 if (window.internals) { | |
56 internals.settings.setUnifiedTextCheckerEnabled(true); | |
57 internals.settings.setAsynchronousSpellCheckingEnabled(true); | |
50 } | 58 } |
51 | 59 |
52 function testMarkerForMisspelledWord(id, shouldBeMarked) { | 60 // Type misspelling to all input elements. |
61 var inputs = document.getElementsByTagName('input'); | |
62 for (var i = 0; i < inputs.length; i++) | |
63 typeText(inputs[i], 'zz '); | |
64 | |
65 var shouldBeMarked; | |
66 | |
67 function testMarkerForMisspelledWord(id, isMisspelled) { | |
68 if (!window.internals) | |
69 return done(); | |
70 | |
53 var inputElement = document.getElementById(id); | 71 var inputElement = document.getElementById(id); |
72 // Spelling markers for input will appear if it's focused. | |
54 inputElement.focus(); | 73 inputElement.focus(); |
55 document.execCommand("InsertText", false, 'z'); | |
56 document.execCommand("InsertText", false, 'z'); | |
57 document.execCommand("InsertText", false, ' '); | |
58 | 74 |
59 log("id=" + id + " type=" + inputElement.type + " spellcheck=" + inputElemen t.spellcheck | 75 debug("id=" + id + " type=" + inputElement.type + " spellcheck=" + inputElem ent.spellcheck |
60 + " parent's spellcheck=" + inputElement.parentNode.spellcheck); | 76 + " parent's spellcheck=" + inputElement.parentNode.spellcheck); |
61 | 77 |
62 shouldBe("internals.hasSpellingMarker(document, 0, 2)", shouldBeMarked ? "tr ue" : "false") | 78 shouldBeMarked = isMisspelled; |
79 shouldBecomeEqual('internals.hasSpellingMarker(document, 0, 2)', 'shouldBeMa rked', done); | |
63 } | 80 } |
64 | 81 |
65 // For type="text". | 82 var tests = [ |
66 testMarkerForMisspelledWord('test1_1', true); | 83 // For type="text". |
67 testMarkerForMisspelledWord('test1_2', true); | 84 function() { testMarkerForMisspelledWord('test1_1', true); }, |
68 testMarkerForMisspelledWord('test1_3', false); | 85 function() { testMarkerForMisspelledWord('test1_2', true); }, |
69 testMarkerForMisspelledWord('test1_4', true); | 86 function() { testMarkerForMisspelledWord('test1_3', false); }, |
70 testMarkerForMisspelledWord('test1_5', true); | 87 function() { testMarkerForMisspelledWord('test1_4', true); }, |
71 testMarkerForMisspelledWord('test1_6', true); | 88 function() { testMarkerForMisspelledWord('test1_5', true); }, |
72 log(""); | 89 function() { testMarkerForMisspelledWord('test1_6', true); }, |
73 testMarkerForMisspelledWord('test2_1', false); | 90 function() { testMarkerForMisspelledWord('test2_1', false); }, |
74 testMarkerForMisspelledWord('test2_2', true); | 91 function() { testMarkerForMisspelledWord('test2_2', true); }, |
75 testMarkerForMisspelledWord('test2_3', false); | 92 function() { testMarkerForMisspelledWord('test2_3', false); }, |
76 testMarkerForMisspelledWord('test2_4', false); | 93 function() { testMarkerForMisspelledWord('test2_4', false); }, |
77 testMarkerForMisspelledWord('test2_5', true); | 94 function() { testMarkerForMisspelledWord('test2_5', true); }, |
78 testMarkerForMisspelledWord('test2_6', false); | 95 function() { testMarkerForMisspelledWord('test2_6', false); }, |
79 log(""); | 96 // For type="search". |
97 function() { testMarkerForMisspelledWord('test3_1', true); }, | |
98 function() { testMarkerForMisspelledWord('test3_2', true); }, | |
99 function() { testMarkerForMisspelledWord('test3_3', false); }, | |
100 function() { testMarkerForMisspelledWord('test3_4', true); }, | |
101 function() { testMarkerForMisspelledWord('test3_5', true); }, | |
102 function() { testMarkerForMisspelledWord('test3_6', true); }, | |
103 function() { testMarkerForMisspelledWord('test4_1', false); }, | |
104 function() { testMarkerForMisspelledWord('test4_2', true); }, | |
105 function() { testMarkerForMisspelledWord('test4_3', false); }, | |
106 function() { testMarkerForMisspelledWord('test4_4', false); }, | |
107 function() { testMarkerForMisspelledWord('test4_5', true); }, | |
108 function() { testMarkerForMisspelledWord('test4_6', false); } | |
109 ]; | |
80 | 110 |
81 // For type="search". | 111 function done() |
82 testMarkerForMisspelledWord('test3_1', true); | 112 { |
83 testMarkerForMisspelledWord('test3_2', true); | 113 var next = tests.shift(); |
84 testMarkerForMisspelledWord('test3_3', false); | 114 if (next) |
85 testMarkerForMisspelledWord('test3_4', true); | 115 return window.setTimeout(next, 0); |
86 testMarkerForMisspelledWord('test3_5', true); | |
87 testMarkerForMisspelledWord('test3_6', true); | |
88 log(""); | |
89 testMarkerForMisspelledWord('test4_1', false); | |
90 testMarkerForMisspelledWord('test4_2', true); | |
91 testMarkerForMisspelledWord('test4_3', false); | |
92 testMarkerForMisspelledWord('test4_4', false); | |
93 testMarkerForMisspelledWord('test4_5', true); | |
94 testMarkerForMisspelledWord('test4_6', false); | |
95 | 116 |
96 if (window.testRunner) { | 117 if (window.testRunner) { |
97 // Cleaning up for expeation text if running on DRT. | 118 // Cleaning up for expectation text if running on DRT. |
98 document.getElementById("testRoot").style.display = "none"; | 119 document.getElementById("testRoot").style.display = "none"; |
120 } | |
121 finishJSTest(); | |
99 } | 122 } |
123 done(); | |
100 </script> | 124 </script> |
101 </body> | 125 </body> |
102 </html> | 126 </html> |
OLD | NEW |