Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: third_party/WebKit/LayoutTests/editing/spelling/grammar-markers.html

Issue 2270293003: Add a switch to TestRunner to enable/disable mock spell checker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use in-class initialization Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../../resources/js-test.js"></script> 4 <script src="../../resources/js-test.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.testRunner) 15 if (window.testRunner) {
16 testRunner.dumpAsTextWithPixelResults(); 16 testRunner.dumpAsTextWithPixelResults();
17 testRunner.setMockSpellCheckerEnabled(true);
18 }
17 19
18 function verifyGrammarMarker(destination, ungrammaticalPhrase) 20 function verifyGrammarMarker(destination, ungrammaticalPhrase)
19 { 21 {
20 if (window.internals && internals.hasGrammarMarker(document, destination.inn erHTML.indexOf(ungrammaticalPhrase), ungrammaticalPhrase.length)) { 22 if (window.internals && internals.hasGrammarMarker(document, destination.inn erHTML.indexOf(ungrammaticalPhrase), ungrammaticalPhrase.length)) {
21 testPassed("ungrammatical phrase '" + ungrammaticalPhrase + "' on '" + d estination.innerHTML + "'"); 23 testPassed("ungrammatical phrase '" + ungrammaticalPhrase + "' on '" + d estination.innerHTML + "'");
22 return true; 24 return true;
23 } else 25 } else
24 return false; 26 return false;
25 } 27 }
26 28
27 var source = document.getElementById('source'); 29 var source = document.getElementById('source');
28 window.getSelection().selectAllChildren(source); 30 window.getSelection().selectAllChildren(source);
29 document.execCommand('Copy'); 31 document.execCommand('Copy');
30 var target = document.getElementById('target'); 32 var target = document.getElementById('target');
31 window.getSelection().selectAllChildren(target); 33 window.getSelection().selectAllChildren(target);
32 document.execCommand('Paste'); 34 document.execCommand('Paste');
33 35
34 shouldBecomeEqual('verifyGrammarMarker(target, "has")', 'true', finishJSTest); 36 shouldBecomeEqual('verifyGrammarMarker(target, "has")', 'true', finishJSTest);
35 37
36 </script> 38 </script>
37 </body> 39 </body>
38 </html> 40 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698