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="../../fast/js/resources/js-test-pre.js"></script> |
5 </head> | 6 </head> |
6 <body> | 7 <body> |
7 <p>This tests if the "spellcheck" attribute is implemented as written in its spe
cification. If this test succeeds, you can see six forms filled with an invalid
word 'zz '. Nevertheless, the 'zz ' only in the line 1.1, 1.2, and 2.2 are marke
d as misspelled.</p> | 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. |
8 <div id="testRoot"> | 9 <div id="testRoot"> |
9 | 10 |
10 <div spellcheck="true"> | 11 <div spellcheck="true"> |
11 <label>1.1.</label><input id="test1_1" type="text"></input><br/> | 12 <label>1.1.</label><input id="test1_1" type="text"></input><br/> |
12 <label>1.2.</label><input id="test1_2" type="text" spellcheck="true"></input><br
/> | 13 <label>1.2.</label><input id="test1_2" type="text" spellcheck="true"></input><br
/> |
13 <label>1.3.</label><input id="test1_3" type="text" spellcheck="false"></input><b
r/> | 14 <label>1.3.</label><input id="test1_3" type="text" spellcheck="false"></input><b
r/> |
14 <label>1.4.</label><input id="test1_4" type="text" spellcheck="InvalidValue"></i
nput><br/> | 15 <label>1.4.</label><input id="test1_4" type="text" spellcheck="InvalidValue"></i
nput><br/> |
15 <label>1.5.</label><input id="test1_5" type="text" spellcheck></input><br/> | 16 <label>1.5.</label><input id="test1_5" type="text" spellcheck></input><br/> |
16 <label>1.6.</label><input id="test1_6" type="text"></input><br/> | 17 <label>1.6.</label><input id="test1_6" type="text"></input><br/> |
17 </div> | 18 </div> |
(...skipping 23 matching lines...) Expand all Loading... |
41 <label>4.6.</label><input id="test4_6" type="search"></input><br/> | 42 <label>4.6.</label><input id="test4_6" type="search"></input><br/> |
42 </div> | 43 </div> |
43 | 44 |
44 </div> | 45 </div> |
45 <pre id="console"></pre> | 46 <pre id="console"></pre> |
46 <script> | 47 <script> |
47 function log(msg) { | 48 function log(msg) { |
48 document.getElementById("console").innerHTML += (msg + "\n"); | 49 document.getElementById("console").innerHTML += (msg + "\n"); |
49 } | 50 } |
50 | 51 |
51 function testTypingInvalidWord(id, shouldBeMarked) { | 52 function testMarkerForMisspelledWord(id, shouldBeMarked) { |
52 document.getElementById(id).focus(); | 53 var inputElement = document.getElementById(id); |
| 54 inputElement.focus(); |
53 document.execCommand("InsertText", false, 'z'); | 55 document.execCommand("InsertText", false, 'z'); |
54 document.execCommand("InsertText", false, 'z'); | 56 document.execCommand("InsertText", false, 'z'); |
55 document.execCommand("InsertText", false, ' '); | 57 document.execCommand("InsertText", false, ' '); |
56 if (shouldBeMarked == internals.hasSpellingMarker(document, 0, 2)) | 58 |
57 log("PASS:" + id); | 59 log("id=" + id + " type=" + inputElement.type + " spellcheck=" + inputElemen
t.spellcheck |
58 else | 60 + " parent's spellcheck=" + inputElement.parentNode.spellcheck); |
59 log("FAIL:" + id); | 61 |
| 62 shouldBe("internals.hasSpellingMarker(document, 0, 2)", shouldBeMarked ? "tr
ue" : "false") |
60 } | 63 } |
61 | 64 |
62 // For type="text". | 65 // For type="text". |
63 testTypingInvalidWord('test1_1', true); | 66 testMarkerForMisspelledWord('test1_1', true); |
64 testTypingInvalidWord('test1_2', true); | 67 testMarkerForMisspelledWord('test1_2', true); |
65 testTypingInvalidWord('test1_3', false); | 68 testMarkerForMisspelledWord('test1_3', false); |
66 testTypingInvalidWord('test1_4', true); | 69 testMarkerForMisspelledWord('test1_4', true); |
67 testTypingInvalidWord('test1_5', true); | 70 testMarkerForMisspelledWord('test1_5', true); |
68 testTypingInvalidWord('test1_6', true); | 71 testMarkerForMisspelledWord('test1_6', true); |
69 testTypingInvalidWord('test2_1', false); | 72 log(""); |
70 testTypingInvalidWord('test2_2', true); | 73 testMarkerForMisspelledWord('test2_1', false); |
71 testTypingInvalidWord('test2_3', false); | 74 testMarkerForMisspelledWord('test2_2', true); |
72 testTypingInvalidWord('test2_4', false); | 75 testMarkerForMisspelledWord('test2_3', false); |
73 testTypingInvalidWord('test2_5', true); | 76 testMarkerForMisspelledWord('test2_4', false); |
74 testTypingInvalidWord('test2_6', false); | 77 testMarkerForMisspelledWord('test2_5', true); |
| 78 testMarkerForMisspelledWord('test2_6', false); |
| 79 log(""); |
75 | 80 |
76 // For type="search". | 81 // For type="search". |
77 testTypingInvalidWord('test3_1', true); | 82 testMarkerForMisspelledWord('test3_1', true); |
78 testTypingInvalidWord('test3_2', true); | 83 testMarkerForMisspelledWord('test3_2', true); |
79 testTypingInvalidWord('test3_3', false); | 84 testMarkerForMisspelledWord('test3_3', false); |
80 testTypingInvalidWord('test3_4', true); | 85 testMarkerForMisspelledWord('test3_4', true); |
81 testTypingInvalidWord('test3_5', true); | 86 testMarkerForMisspelledWord('test3_5', true); |
82 testTypingInvalidWord('test3_6', true); | 87 testMarkerForMisspelledWord('test3_6', true); |
83 testTypingInvalidWord('test4_1', false); | 88 log(""); |
84 testTypingInvalidWord('test4_2', true); | 89 testMarkerForMisspelledWord('test4_1', false); |
85 testTypingInvalidWord('test4_3', false); | 90 testMarkerForMisspelledWord('test4_2', true); |
86 testTypingInvalidWord('test4_4', false); | 91 testMarkerForMisspelledWord('test4_3', false); |
87 testTypingInvalidWord('test4_5', true); | 92 testMarkerForMisspelledWord('test4_4', false); |
88 testTypingInvalidWord('test4_6', false); | 93 testMarkerForMisspelledWord('test4_5', true); |
| 94 testMarkerForMisspelledWord('test4_6', false); |
89 | 95 |
90 if (window.testRunner) { | 96 if (window.testRunner) { |
91 testRunner.dumpAsText(); | 97 testRunner.dumpAsText(); |
92 // Cleaning up for expeation text if running on DRT. | 98 // Cleaning up for expeation text if running on DRT. |
93 document.getElementById("testRoot").style.display = "none"; | 99 document.getElementById("testRoot").style.display = "none"; |
94 } | 100 } |
95 </script> | 101 </script> |
96 </body> | 102 </body> |
97 </html> | 103 </html> |
OLD | NEW |