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