OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <script src="../../resources/js-test.js"></script> |
| 5 </head> |
| 6 <body> |
| 7 <div id="source" contenteditable="true" spellcheck="false">You has the right.</d
iv> |
| 8 <div id="target" contenteditable="true" spellcheck="true"></div> |
| 9 |
| 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".'); |
| 12 |
| 13 jsTestIsAsync = true; |
| 14 |
| 15 function verifyGrammarMarker(destination, ungrammaticalPhrase) |
| 16 { |
| 17 if (internals.hasGrammarMarker(document, destination.innerHTML.indexOf(ungra
mmaticalPhrase), ungrammaticalPhrase.length)) { |
| 18 testPassed("ungrammatical phrase '" + ungrammaticalPhrase + "' on '" + d
estination.innerHTML + "'"); |
| 19 return true; |
| 20 } else |
| 21 return false; |
| 22 } |
| 23 |
| 24 if (window.testRunner) { |
| 25 testRunner.dumpAsTextWithPixelResults(); |
| 26 testRunner.setBackingScaleFactor(2, function () { |
| 27 shouldBecomeEqual('verifyGrammarMarker(target, "has")', 'true', finishJS
Test); |
| 28 }); |
| 29 } |
| 30 |
| 31 var source = document.getElementById('source'); |
| 32 window.getSelection().selectAllChildren(source); |
| 33 document.execCommand('Copy'); |
| 34 var target = document.getElementById('target'); |
| 35 window.getSelection().selectAllChildren(target); |
| 36 document.execCommand('Paste'); |
| 37 |
| 38 </script> |
| 39 </body> |
| 40 </html> |
OLD | NEW |