| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <script src="../../resources/testharness.js"></script> |
| 3 <body spellcheck="false"> | 3 <script src="../../resources/testharnessreport.js"></script> |
| 4 <script src="../editing.js"></script> | 4 <script src="../assert_selection.js"></script> |
| 5 <script src="../../resources/js-test.js"></script> | 5 <script src="spellcheck_test.js"></script> |
| 6 <div id="misspelled" onmouseup="checkSpellingMarker()">asd is misspelled.</div> | |
| 7 <script> | 6 <script> |
| 8 description("This tests whether WebKit does not spell check in 'designMode' " | 7 spellcheck_test( |
| 9 + "when spellcheck='false'. To test manually, click 'asd' and move cursor un
til '.'. " | 8 [ |
| 10 + "There should be no spelling marker for 'asd'."); | 9 '<div id="container" spellcheck="false">', |
| 11 | 10 '<div>|asd is misspelled.</div>', |
| 12 jsTestIsAsync = true; | 11 '</div>' |
| 13 if (window.testRunner) | 12 ].join(''), |
| 14 testRunner.setMockSpellCheckerEnabled(true); | 13 document => { |
| 15 | 14 document.designMode = 'on'; |
| 16 document.designMode = "on"; | 15 document.getSelection().modify('move', 'forward', 'word'); |
| 17 | 16 }, |
| 18 function checkSpellingMarker() | 17 [ |
| 19 { | 18 '<div id="container" spellcheck="false">', |
| 20 if (!window.internals) | 19 '<div>asd is misspelled.</div>', |
| 21 return; | 20 '</div>' |
| 22 | 21 ].join(''), |
| 23 // First, verify spelling with spellcheck attribute off. | 22 { |
| 24 // Move selection to the next word to notify WebKit that "asd" has been type
d/changed | 23 title: 'No spelling marker in designMode when spellcheck=false.', |
| 25 // to give a chance to spellcheck. | 24 callback: sample => spellcheck_test( |
| 26 moveSelectionForwardByWordCommand(); | 25 sample, |
| 27 | 26 document => { |
| 28 shouldBecomeEqual('internals.hasSpellingMarker(document, 0, 3)', 'false', fu
nction() { | 27 document.getElementById('container').setAttribute('spellcheck', 'tru
e'); |
| 29 evalAndLog('document.body.setAttribute("spellcheck", "true")'); | 28 // Do any selection change to force spellchecking after attribute ch
ange. |
| 30 // Do any selection change to force spellchecking after attribute change
. | 29 document.getSelection().modify('move', 'forward', 'line'); |
| 31 moveSelectionForwardByLineCommand(); | 30 }, |
| 32 shouldBecomeDifferent('internals.hasSpellingMarker(document, 0, 3)', 'fa
lse', finishJSTest); | 31 [ |
| 32 '<div id="container" spellcheck="true">', |
| 33 '<div>_asd_ is misspelled.</div>', |
| 34 '</div>' |
| 35 ].join(''), |
| 36 'Spelling marker appears when changing spellcheck from false to true.'
) |
| 33 }); | 37 }); |
| 34 } | 38 </script> |
| 35 | |
| 36 if (window.eventSender) { | |
| 37 var misspelledDiv = document.getElementById("misspelled"); | |
| 38 var x = misspelledDiv.offsetLeft; | |
| 39 var y = misspelledDiv.offsetTop; | |
| 40 eventSender.mouseMoveTo(x, y); | |
| 41 eventSender.mouseDown(); | |
| 42 eventSender.mouseUp(); | |
| 43 } | |
| 44 </script> | |
| 45 </body> | |
| 46 </html> | |
| OLD | NEW |