| OLD | NEW |
| 1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src="../../fast/js/resources/js-test-pre.js"></script> | 4 <script src="../../fast/js/resources/js-test-pre.js"></script> |
| 5 <script src="resources/js-test-selection-shared.js"></script> | 5 <script src="resources/js-test-selection-shared.js"></script> |
| 6 </head> | 6 </head> |
| 7 <body> | 7 <body> |
| 8 <div> | 8 <div> |
| 9 <div id="src" contenteditable="true" spellcheck="true"></div> | 9 <div id="src" contenteditable="true" spellcheck="true"></div> |
| 10 </div> | 10 </div> |
| 11 <script language="javascript"> | 11 <script language="javascript"> |
| 12 description('Test if WebKit does not spellcheck text when pasting text and conti
nuous spellcheck is turned off. ' + | 12 description('Test if WebKit does not spellcheck text when pasting text and conti
nuous spellcheck is turned off. ' + |
| 13 'To test manually, disable continuous spellcheck, copy the text "zz
apple" and paste it to the textarea. ' + | 13 'To test manually, disable continuous spellcheck, copy the text "zz
apple" and paste it to the textarea. ' + |
| 14 'When "zz" is not marked as misspelled, this test succeeds.'); | 14 'When "zz" is not marked as misspelled, this test succeeds.'); |
| 15 | 15 |
| 16 jsTestIsAsync = true; | |
| 17 | |
| 18 // Insert a misspelled word to initialize a spellchecker. | 16 // Insert a misspelled word to initialize a spellchecker. |
| 19 var srcNode = document.getElementById('src'); | 17 var srcNode = document.getElementById('src'); |
| 20 srcNode.focus(); | 18 srcNode.focus(); |
| 21 document.execCommand("InsertText", false, 'z'); | 19 document.execCommand("InsertText", false, 'z'); |
| 22 document.execCommand("InsertText", false, 'z'); | 20 document.execCommand("InsertText", false, 'z'); |
| 23 document.execCommand("InsertText", false, ' '); | 21 document.execCommand("InsertText", false, ' '); |
| 24 document.execCommand("InsertText", false, 'a'); | 22 document.execCommand("InsertText", false, 'a'); |
| 25 document.execCommand("InsertText", false, 'p'); | 23 document.execCommand("InsertText", false, 'p'); |
| 26 document.execCommand("InsertText", false, 'p'); | 24 document.execCommand("InsertText", false, 'p'); |
| 27 document.execCommand("InsertText", false, 'l'); | 25 document.execCommand("InsertText", false, 'l'); |
| 28 document.execCommand("InsertText", false, 'e'); | 26 document.execCommand("InsertText", false, 'e'); |
| 29 shouldBeTrue('internals.hasSpellingMarker(document, 0, 2)'); | 27 shouldBeTrue('internals.hasSpellingMarker(document, 0, 2)'); |
| 30 window.getSelection().selectAllChildren(srcNode); | 28 window.getSelection().selectAllChildren(srcNode); |
| 31 document.execCommand('Copy'); | 29 document.execCommand('Copy'); |
| 32 | 30 |
| 33 internals.settings.setAsynchronousSpellCheckingEnabled(true); | |
| 34 internals.setContinuousSpellCheckingEnabled(false); | 31 internals.setContinuousSpellCheckingEnabled(false); |
| 35 | 32 |
| 36 document.execCommand('Paste'); | 33 document.execCommand('Paste'); |
| 34 shouldBeFalse('internals.hasSpellingMarker(document, 0, 2)'); |
| 37 | 35 |
| 38 var retryCount = 10; | |
| 39 var sleepPeriod = 1; | |
| 40 function verifyMarker() { | |
| 41 srcNode.focus(); | |
| 42 var hasMarker = internals.hasSpellingMarker(document, 0, 2); | |
| 43 if (!hasMarker && --retryCount > 0) { | |
| 44 sleepPeriod *= 2; | |
| 45 window.setTimeout(verifyMarker, sleepPeriod); | |
| 46 return; | |
| 47 } | |
| 48 if (hasMarker) | |
| 49 testFailed('The destination node should not have a marker.'); | |
| 50 else | |
| 51 testPassed('The destination node does not have any markers.'); | |
| 52 finishJSTest(); | |
| 53 } | |
| 54 window.setTimeout(verifyMarker, sleepPeriod); | |
| 55 </script> | 36 </script> |
| 56 <script src="../../fast/js/resources/js-test-post.js"></script> | 37 <script src="../../fast/js/resources/js-test-post.js"></script> |
| 57 </body> | 38 </body> |
| 58 </html> | 39 </html> |
| OLD | NEW |