| 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/js-test.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 if (window.testRunner) |
| 15 testRunner.setMockSpellCheckerEnabled(true); |
| 14 | 16 |
| 15 function verifyGrammarMarker(destination, ungrammaticalPhrase) | 17 function verifyGrammarMarker(destination, ungrammaticalPhrase) |
| 16 { | 18 { |
| 17 if (internals.hasGrammarMarker(document, destination.innerHTML.indexOf(ungra
mmaticalPhrase), ungrammaticalPhrase.length)) { | 19 if (internals.hasGrammarMarker(document, destination.innerHTML.indexOf(ungra
mmaticalPhrase), ungrammaticalPhrase.length)) { |
| 18 testPassed("ungrammatical phrase '" + ungrammaticalPhrase + "' on '" + d
estination.innerHTML + "'"); | 20 testPassed("ungrammatical phrase '" + ungrammaticalPhrase + "' on '" + d
estination.innerHTML + "'"); |
| 19 return true; | 21 return true; |
| 20 } else | 22 } else |
| 21 return false; | 23 return false; |
| 22 } | 24 } |
| 23 | 25 |
| 24 if (window.testRunner) { | 26 if (window.testRunner) { |
| 25 testRunner.dumpAsTextWithPixelResults(); | 27 testRunner.dumpAsTextWithPixelResults(); |
| 26 testRunner.setBackingScaleFactor(2, function () { | 28 testRunner.setBackingScaleFactor(2, function () { |
| 27 shouldBecomeEqual('verifyGrammarMarker(target, "has")', 'true', finishJS
Test); | 29 shouldBecomeEqual('verifyGrammarMarker(target, "has")', 'true', finishJS
Test); |
| 28 }); | 30 }); |
| 29 } | 31 } |
| 30 | 32 |
| 31 var source = document.getElementById('source'); | 33 var source = document.getElementById('source'); |
| 32 window.getSelection().selectAllChildren(source); | 34 window.getSelection().selectAllChildren(source); |
| 33 document.execCommand('Copy'); | 35 document.execCommand('Copy'); |
| 34 var target = document.getElementById('target'); | 36 var target = document.getElementById('target'); |
| 35 window.getSelection().selectAllChildren(target); | 37 window.getSelection().selectAllChildren(target); |
| 36 document.execCommand('Paste'); | 38 document.execCommand('Paste'); |
| 37 | 39 |
| 38 </script> | 40 </script> |
| 39 </body> | 41 </body> |
| 40 </html> | 42 </html> |
| OLD | NEW |