| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <body spellcheck="false"> |
| 4 <script src="../editing.js"></script> |
| 4 <script src="../../resources/js-test.js"></script> | 5 <script src="../../resources/js-test.js"></script> |
| 5 </head> | 6 <div id="misspelled" onmouseup="checkSpellingMarker()">asd is misspelled.</div> |
| 6 <body spellcheck="false"> | |
| 7 asdf is misspelled. | |
| 8 <script> | 7 <script> |
| 9 description("This tests whether WebKit does not spell check in 'designMode' " | 8 description("This tests whether WebKit does not spell check in 'designMode' " |
| 10 + "when spellcheck='false'. To test manually, click 'asdf' above. " | 9 + "when spellcheck='false'. To test manually, click 'asd' and move cursor un
til '.'. " |
| 11 + "There should be no spelling marker for 'asdf' after the click."); | 10 + "There should be no spelling marker for 'asd'."); |
| 12 | 11 |
| 13 jsTestIsAsync = true; | 12 jsTestIsAsync = true; |
| 14 | 13 |
| 15 if (window.internals) { | 14 if (window.internals) { |
| 16 internals.settings.setUnifiedTextCheckerEnabled(true); | 15 internals.settings.setUnifiedTextCheckerEnabled(true); |
| 17 internals.settings.setAsynchronousSpellCheckingEnabled(true); | 16 internals.settings.setAsynchronousSpellCheckingEnabled(true); |
| 18 } | 17 } |
| 19 | 18 |
| 20 document.designMode = "on"; | 19 document.designMode = "on"; |
| 21 | 20 |
| 22 document.body.addEventListener('mousedown', function() { | 21 function checkSpellingMarker() |
| 23 if (document.activeElement != document.body) { | 22 { |
| 24 testFailed('Active element after click is not body element'); | 23 if (!window.internals) |
| 25 finishJSTest(); | 24 return; |
| 26 } | |
| 27 | 25 |
| 28 if (window.internals) | 26 // First, verify spelling with spellcheck attribute off. |
| 29 shouldBecomeEqual('internals.hasSpellingMarker(document, 0, 4)', 'false'
, finishJSTest); | 27 // Move selection to the next word to notify WebKit that "asd" has been type
d/changed |
| 30 }); | 28 // to give a chance to spellcheck. |
| 29 moveSelectionForwardByWordCommand(); |
| 30 |
| 31 shouldBecomeEqual('internals.hasSpellingMarker(document, 0, 3)', 'false', fu
nction() { |
| 32 evalAndLog('document.body.setAttribute("spellcheck", "true")'); |
| 33 // Do any selection change to force spellchecking after attribute change
. |
| 34 moveSelectionForwardByLineCommand(); |
| 35 shouldBecomeDifferent('internals.hasSpellingMarker(document, 0, 3)', 'fa
lse', finishJSTest); |
| 36 }); |
| 37 } |
| 31 | 38 |
| 32 if (window.eventSender) { | 39 if (window.eventSender) { |
| 33 var x = document.body.offsetLeft + 10; | 40 var misspelledDiv = document.getElementById("misspelled"); |
| 34 var y = document.body.offsetTop + 17; | 41 var x = misspelledDiv.offsetLeft; |
| 42 var y = misspelledDiv.offsetTop; |
| 35 eventSender.mouseMoveTo(x, y); | 43 eventSender.mouseMoveTo(x, y); |
| 36 eventSender.mouseDown(); | 44 eventSender.mouseDown(); |
| 37 eventSender.mouseUp(); | 45 eventSender.mouseUp(); |
| 38 } | 46 } |
| 39 | |
| 40 </script> | 47 </script> |
| 41 </body> | 48 </body> |
| 42 </html> | 49 </html> |
| OLD | NEW |