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

Side by Side Diff: third_party/WebKit/LayoutTests/editing/spelling/context-menu-suggestions.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, 4 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 <body onload="test()"> 1 <body onload="test()">
2 <p>This test checks that spelling suggestions in the context menu are not show w hen spellcheck="false". 2 <p>This test checks that spelling suggestions in the context menu are not show w hen spellcheck="false".
3 To test manually, right click on the text in the input box.</p> 3 To test manually, right click on the text in the input box.</p>
4 <input id="input" spellcheck="false" /> 4 <input id="input" spellcheck="false" />
5 <div id="result">FAIL: Did not run test</div> 5 <div id="result">FAIL: Did not run test</div>
6 </body> 6 </body>
7 <script> 7 <script>
8 function test() 8 function test()
9 { 9 {
10 if (window.testRunner) 10 if (window.testRunner) {
11 testRunner.setMockSpellCheckerEnabled(true);
11 testRunner.dumpAsText(); 12 testRunner.dumpAsText();
13 }
12 14
13 var input = document.getElementById("input"); 15 var input = document.getElementById("input");
14 input.focus(); 16 input.focus();
15 document.execCommand("InsertText", false, 'wellcome'); 17 document.execCommand("InsertText", false, 'wellcome');
16 document.execCommand("InsertText", false, ' '); 18 document.execCommand("InsertText", false, ' ');
17 19
18 var x = input.offsetParent.offsetLeft + input.offsetLeft + 4; 20 var x = input.offsetParent.offsetLeft + input.offsetLeft + 4;
19 var y = input.offsetParent.offsetTop + input.offsetTop + input.offsetHeight / 2; 21 var y = input.offsetParent.offsetTop + input.offsetTop + input.offsetHeight / 2;
20 22
21 if (!window.eventSender) 23 if (!window.eventSender)
22 return; 24 return;
23 25
24 eventSender.mouseMoveTo(x, y); 26 eventSender.mouseMoveTo(x, y);
25 var itemNamesWithoutSpellChecking = eventSender.contextClick(); 27 var itemNamesWithoutSpellChecking = eventSender.contextClick();
26 28
27 input.setAttribute("spellcheck", "true"); 29 input.setAttribute("spellcheck", "true");
28 eventSender.mouseMoveTo(x, y); 30 eventSender.mouseMoveTo(x, y);
29 31
30 var itemNamesWithSpellChecking = eventSender.contextClick(); 32 var itemNamesWithSpellChecking = eventSender.contextClick();
31 33
32 if (itemNamesWithSpellChecking.length > itemNamesWithoutSpellChecking.length ) 34 if (itemNamesWithSpellChecking.length > itemNamesWithoutSpellChecking.length )
33 document.getElementById('result').innerHTML = 'SUCCESS'; 35 document.getElementById('result').innerHTML = 'SUCCESS';
34 else 36 else
35 document.getElementById('result').innerHTML = 'FAILURE: No spell checkin g suggestions'; 37 document.getElementById('result').innerHTML = 'FAILURE: No spell checkin g suggestions';
36 } 38 }
37 </script> 39 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698