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; | 17 jsTestIsAsync = true; |
18 | 18 |
| 19 internals.settings.setAsynchronousSpellCheckingEnabled(true); |
| 20 |
19 // Insert a misspelled word to initialize a spellchecker. | 21 // Insert a misspelled word to initialize a spellchecker. |
20 var srcNode = document.getElementById('src'); | 22 var srcNode = document.getElementById('src'); |
21 srcNode.focus(); | 23 srcNode.focus(); |
22 document.execCommand("InsertText", false, 'z'); | 24 document.execCommand("InsertText", false, 'z'); |
23 document.execCommand("InsertText", false, 'z'); | 25 document.execCommand("InsertText", false, 'z'); |
24 document.execCommand("InsertText", false, ' '); | 26 document.execCommand("InsertText", false, ' '); |
25 document.execCommand("InsertText", false, 'a'); | 27 document.execCommand("InsertText", false, 'a'); |
26 document.execCommand("InsertText", false, 'p'); | 28 document.execCommand("InsertText", false, 'p'); |
27 document.execCommand("InsertText", false, 'p'); | 29 document.execCommand("InsertText", false, 'p'); |
28 document.execCommand("InsertText", false, 'l'); | 30 document.execCommand("InsertText", false, 'l'); |
29 document.execCommand("InsertText", false, 'e'); | 31 document.execCommand("InsertText", false, 'e'); |
30 shouldBeTrue('internals.hasSpellingMarker(document, 0, 2)'); | 32 shouldBecomeEqual('internals.hasSpellingMarker(document, 0, 2)', 'true', functio
n(){}); |
31 window.getSelection().selectAllChildren(srcNode); | 33 window.getSelection().selectAllChildren(srcNode); |
32 document.execCommand('Copy'); | 34 document.execCommand('Copy'); |
33 | 35 |
34 internals.settings.setAsynchronousSpellCheckingEnabled(true); | |
35 | |
36 var dstNode = document.getElementById('dst'); | 36 var dstNode = document.getElementById('dst'); |
37 dstNode.focus(); | 37 dstNode.focus(); |
38 document.execCommand('Paste'); | 38 document.execCommand('Paste'); |
| 39 shouldBecomeDifferent('internals.hasSpellingMarker(document, 0, 2)', 'true', fin
ishJSTest); |
39 | 40 |
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> | 41 </script> |
58 <script src="../../fast/js/resources/js-test-post.js"></script> | 42 <script src="../../fast/js/resources/js-test-post.js"></script> |
59 </body> | 43 </body> |
60 </html> | 44 </html> |
OLD | NEW |