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