OLD | NEW |
1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../../resources/js-test.js"></script> | 4 <script src="../../resources/testharness.js"></script> |
| 5 <script src="../../resources/testharnessreport.js"></script> |
| 6 <script src="resources/util.js"></script> |
5 </head> | 7 </head> |
6 <body> | 8 <body> |
7 <div> | 9 <div> |
8 <div id="src" contenteditable="true" spellcheck="true"></div> | 10 <div id="src" contenteditable></div><br/> |
9 </div> | 11 </div> |
10 <script language="javascript"> | 12 <script> |
11 description('Test if WebKit does not spellcheck text when pasting text and conti
nuous spellcheck is turned off. ' + | 13 var srcNode = document.getElementById('src'); |
12 'To test manually, disable continuous spellcheck, copy the text "zz
apple" and paste it to the textarea. ' + | |
13 'When "zz" is not marked as misspelled, this test succeeds.'); | |
14 | 14 |
15 jsTestIsAsync = true; | 15 steps = [ |
| 16 // Insert a misspelled word to initialize a spellchecker. |
| 17 // Break the insertion of 'zz apple' into two parts to wait for the spelling |
| 18 // markers under 'zz' to appear. |
| 19 function() { |
| 20 srcNode.focus(); |
| 21 document.execCommand('InsertText', false, 'z'); |
| 22 document.execCommand('InsertText', false, 'z'); |
| 23 document.execCommand('InsertText', false, ' '); |
| 24 }, |
| 25 function() { |
| 26 document.execCommand('InsertText', false, 'a'); |
| 27 document.execCommand('InsertText', false, 'p'); |
| 28 document.execCommand('InsertText', false, 'p'); |
| 29 document.execCommand('InsertText', false, 'l'); |
| 30 document.execCommand('InsertText', false, 'e'); |
| 31 }, |
| 32 function() { |
| 33 window.getSelection().selectAllChildren(srcNode); |
| 34 document.execCommand('Copy'); |
| 35 internals.setContinuousSpellCheckingEnabled(false); |
| 36 document.execCommand('Paste'); |
| 37 } |
| 38 ]; |
16 | 39 |
17 // Insert a misspelled word to initialize a spellchecker. | 40 assertions = [ |
18 var srcNode = document.getElementById('src'); | 41 () => {}, |
19 srcNode.focus(); | 42 () => assert_true(internals.hasSpellingMarker(document, 0, 2)), |
20 document.execCommand("InsertText", false, 'z'); | 43 () => assert_false(internals.hasSpellingMarker(document, 0, 2)) |
21 document.execCommand("InsertText", false, 'z'); | 44 ]; |
22 document.execCommand("InsertText", false, ' '); | |
23 document.execCommand("InsertText", false, 'a'); | |
24 document.execCommand("InsertText", false, 'p'); | |
25 document.execCommand("InsertText", false, 'p'); | |
26 document.execCommand("InsertText", false, 'l'); | |
27 document.execCommand("InsertText", false, 'e'); | |
28 shouldBecomeEqual('internals.hasSpellingMarker(document, 0, 2)', 'true', functio
n() {}); | |
29 window.getSelection().selectAllChildren(srcNode); | |
30 document.execCommand('Copy'); | |
31 | 45 |
32 internals.setContinuousSpellCheckingEnabled(false); | 46 runSpellingTest(steps, assertions, 'Blink does not spellcheck text when pasting
text and continuous spellcheck is turned off.') |
33 | |
34 document.execCommand('Paste'); | |
35 shouldBecomeDifferent('internals.hasSpellingMarker(document, 0, 2)', 'true', fin
ishJSTest); | |
36 | |
37 </script> | 47 </script> |
38 </body> | 48 </body> |
39 </html> | 49 </html> |
OLD | NEW |