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