Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / spelling / grammar-markers.html
blob63cd7d410a74a08e1e37ba1fbb325830a895e4a0
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.</div>
8 <div id="target" contenteditable="true" spellcheck="true"></div>
10 <script>
11 description('This tests whether WebKit can render grammar markers when pasting text if it has a grammar-checker. To test manually, copy the text in the first div element and paste it to the second div element. This test succeeds when WebKit renders a grammar marker under a word "has".');
13 jsTestIsAsync = true;
15 if (window.internals)
16 internals.settings.setAsynchronousSpellCheckingEnabled(true);
18 if (window.testRunner)
19 testRunner.dumpAsTextWithPixelResults();
21 function verifyGrammarMarker(destination, ungrammaticalPhrase)
23 if (window.internals && internals.hasGrammarMarker(document, destination.innerHTML.indexOf(ungrammaticalPhrase), ungrammaticalPhrase.length)) {
24 testPassed("ungrammatical phrase '" + ungrammaticalPhrase + "' on '" + destination.innerHTML + "'");
25 return true;
26 } else
27 return false;
30 var source = document.getElementById('source');
31 window.getSelection().selectAllChildren(source);
32 document.execCommand('Copy');
33 var target = document.getElementById('target');
34 window.getSelection().selectAllChildren(target);
35 document.execCommand('Paste');
37 shouldBecomeEqual('verifyGrammarMarker(target, "has")', 'true', finishJSTest);
39 </script>
40 </body>
41 </html>