| 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 </head> | 5 </head> |
| 6 <body> | 6 <body> |
| 7 <div id="source" contenteditable="true" spellcheck="false">You has the right.</d
iv> | 7 <div id="source" contenteditable="true" spellcheck="false">You has the right.</d
iv> |
| 8 <div id="target" contenteditable="true" spellcheck="true"></div> | 8 <div id="target" contenteditable="true" spellcheck="true"></div> |
| 9 | 9 |
| 10 <script> | 10 <script> |
| 11 description('This tests whether WebKit can render grammar markers when pasting t
ext if it has a grammar-checker. To test manually, copy the text in the first di
v element and paste it to the second div element. This test succeeds when WebKit
renders a grammar marker under a word "has".'); | 11 description('This tests whether WebKit can render grammar markers when pasting t
ext if it has a grammar-checker. To test manually, copy the text in the first di
v element and paste it to the second div element. This test succeeds when WebKit
renders a grammar marker under a word "has".'); |
| 12 | 12 |
| 13 jsTestIsAsync = true; | 13 jsTestIsAsync = true; |
| 14 | 14 |
| 15 if (window.internals) | 15 if (window.internals) |
| 16 internals.settings.setAsynchronousSpellCheckingEnabled(true); | 16 internals.settings.setAsynchronousSpellCheckingEnabled(true); |
| 17 | 17 |
| 18 function verifyGrammarMarker(destination, ungrammaticalPhrase) | 18 function verifyGrammarMarker(destination, ungrammaticalPhrase) |
| 19 { | 19 { |
| 20 if (internals.hasGrammarMarker(document, destination.innerHTML.indexOf(ungra
mmaticalPhrase), ungrammaticalPhrase.length)) { | 20 if (internals.hasGrammarMarker(document, destination.innerHTML.indexOf(ungra
mmaticalPhrase), ungrammaticalPhrase.length)) { |
| 21 testPassed("ungrammatical phrase '" + ungrammaticalPhrase + "' on '" + d
estination.innerHTML + "'"); | 21 testPassed("ungrammatical phrase '" + ungrammaticalPhrase + "' on '" + d
estination.innerHTML + "'"); |
| 22 return true; | 22 return true; |
| 23 } else | 23 } else |
| 24 return false; | 24 return false; |
| 25 } | 25 } |
| 26 | 26 |
| 27 if (window.testRunner) { | 27 if (window.testRunner) { |
| 28 testRunner.dumpAsText(true); | 28 testRunner.dumpAsTextWithPixelResults(); |
| 29 testRunner.setBackingScaleFactor(2, function () { | 29 testRunner.setBackingScaleFactor(2, function () { |
| 30 shouldBecomeEqual('verifyGrammarMarker(target, "has")', 'true', finishJS
Test); | 30 shouldBecomeEqual('verifyGrammarMarker(target, "has")', 'true', finishJS
Test); |
| 31 }); | 31 }); |
| 32 } | 32 } |
| 33 | 33 |
| 34 var source = document.getElementById('source'); | 34 var source = document.getElementById('source'); |
| 35 window.getSelection().selectAllChildren(source); | 35 window.getSelection().selectAllChildren(source); |
| 36 document.execCommand('Copy'); | 36 document.execCommand('Copy'); |
| 37 var target = document.getElementById('target'); | 37 var target = document.getElementById('target'); |
| 38 window.getSelection().selectAllChildren(target); | 38 window.getSelection().selectAllChildren(target); |
| 39 document.execCommand('Paste'); | 39 document.execCommand('Paste'); |
| 40 | 40 |
| 41 </script> | 41 </script> |
| 42 <script src="../../fast/js/resources/js-test-post.js"></script> | 42 <script src="../../fast/js/resources/js-test-post.js"></script> |
| 43 </body> | 43 </body> |
| 44 </html> | 44 </html> |
| OLD | NEW |