4 <script src=
"../../resources/js-test.js"></script>
7 <div id=
"source" contenteditable=
"true" spellcheck=
"false">You has the right.
</div>
8 <div id=
"target" contenteditable=
"true" spellcheck=
"true"></div>
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".');
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
+ "'");
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
);