| <!DOCTYPE HTML> |
| <html> |
| <head> |
| <script src="../../fast/js/resources/js-test-pre.js"></script> |
| <script src="resources/js-test-selection-shared.js"></script> |
| </head> |
| <body> |
| <div> |
| <div id="src" contenteditable="true" spellcheck="true"></div><br/> |
| <div id="dst" contenteditable="true" spellcheck="false"></div> |
| </div> |
| <script language="javascript"> |
| description('Test if WebKit does not spellcheck text when pasting text to an element having spellchecking disabled. ' + |
| 'To test manually, copy the text "zz apple" and paste it to the textarea. ' + |
| 'When "zz" is not marked as misspelled, this test succeeds.'); |
| |
| jsTestIsAsync = true; |
| |
| // Insert a misspelled word to initialize a spellchecker. |
| var srcNode = document.getElementById('src'); |
| srcNode.focus(); |
| document.execCommand("InsertText", false, 'z'); |
| document.execCommand("InsertText", false, 'z'); |
| document.execCommand("InsertText", false, ' '); |
| document.execCommand("InsertText", false, 'a'); |
| document.execCommand("InsertText", false, 'p'); |
| document.execCommand("InsertText", false, 'p'); |
| document.execCommand("InsertText", false, 'l'); |
| document.execCommand("InsertText", false, 'e'); |
| shouldBeTrue('internals.hasSpellingMarker(document, 0, 2)'); |
| window.getSelection().selectAllChildren(srcNode); |
| document.execCommand('Copy'); |
| |
| internals.settings.setAsynchronousSpellCheckingEnabled(true); |
| |
| var dstNode = document.getElementById('dst'); |
| dstNode.focus(); |
| document.execCommand('Paste'); |
| |
| var retryCount = 10; |
| var sleepPeriod = 1; |
| function verifyMarker() { |
| dstNode.focus(); |
| var hasMarker = internals.hasSpellingMarker(document, 0, 2); |
| if (!hasMarker && --retryCount > 0) { |
| sleepPeriod *= 2; |
| window.setTimeout(verifyMarker, sleepPeriod); |
| return; |
| } |
| if (hasMarker) |
| testFailed('The destination node should not have a marker.'); |
| else |
| testPassed('The destination node does not have any markers.'); |
| finishJSTest(); |
| } |
| window.setTimeout(verifyMarker, sleepPeriod); |
| </script> |
| <script src="../../fast/js/resources/js-test-post.js"></script> |
| </body> |
| </html> |