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

Side by Side Diff: LayoutTests/editing/spelling/spelling-exactly-selected-word.html

Issue 484353004: Test tidying: use "escape" and "backspace" with eventSender.keyDown() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: More quoting consistency wibbles Created 6 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 <!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 <script src="resources/util.js"></script> 5 <script src="resources/util.js"></script>
6 </head> 6 </head>
7 <body> 7 <body>
8 <div id="container"> 8 <div id="container">
9 <div id="destination" contentEditable></div> 9 <div id="destination" contentEditable></div>
10 </div> 10 </div>
(...skipping 17 matching lines...) Expand all
28 window.getSelection().addRange(wordRange); 28 window.getSelection().addRange(wordRange);
29 29
30 shouldBeEqualToString("window.getSelection().toString()", "wellcome"); 30 shouldBeEqualToString("window.getSelection().toString()", "wellcome");
31 31
32 // Context click on "wellcome" to show the context menu. 32 // Context click on "wellcome" to show the context menu.
33 var x = destination.offsetParent.offsetLeft + destination.offsetLeft + 40; 33 var x = destination.offsetParent.offsetLeft + destination.offsetLeft + 40;
34 var y = destination.offsetParent.offsetTop + destination.offsetTop + destina tion.offsetHeight / 2; 34 var y = destination.offsetParent.offsetTop + destination.offsetTop + destina tion.offsetHeight / 2;
35 eventSender.mouseMoveTo(x, y); 35 eventSender.mouseMoveTo(x, y);
36 contextMenuElements = eventSender.contextClick(); 36 contextMenuElements = eventSender.contextClick();
37 // Esc key to hide the context menu. 37 // Esc key to hide the context menu.
38 eventSender.keyDown(String.fromCharCode(0x001B), null); 38 eventSender.keyDown("escape", null);
39 39
40 spellingMarkerRange = internals.markerRangeForNode(textNode, "spelling", 0); 40 spellingMarkerRange = internals.markerRangeForNode(textNode, "spelling", 0);
41 shouldBeEqualToString("spellingMarkerRange.toString()", "wellcome"); 41 shouldBeEqualToString("spellingMarkerRange.toString()", "wellcome");
42 shouldBeEqualToString("window.getSelection().toString()", "wellcome"); 42 shouldBeEqualToString("window.getSelection().toString()", "wellcome");
43 shouldBeEqualToString("contextMenuElements[contextMenuElements.length - 1]", "welcome"); 43 shouldBeEqualToString("contextMenuElements[contextMenuElements.length - 1]", "welcome");
44 44
45 // Select a correctly spelled word without surrounding whitespace or punctua tion. 45 // Select a correctly spelled word without surrounding whitespace or punctua tion.
46 wordRange.setStart(textNode, 9); 46 wordRange.setStart(textNode, 9);
47 wordRange.setEnd(textNode, 13); 47 wordRange.setEnd(textNode, 13);
48 window.getSelection().removeAllRanges(); 48 window.getSelection().removeAllRanges();
49 window.getSelection().addRange(wordRange); 49 window.getSelection().addRange(wordRange);
50 shouldBeEqualToString("window.getSelection().toString()", "home"); 50 shouldBeEqualToString("window.getSelection().toString()", "home");
51 51
52 // Context click on "home" to show the context menu. 52 // Context click on "home" to show the context menu.
53 var x = destination.offsetParent.offsetLeft + destination.offsetLeft + 80; 53 var x = destination.offsetParent.offsetLeft + destination.offsetLeft + 80;
54 var y = destination.offsetParent.offsetTop + destination.offsetTop + destina tion.offsetHeight / 2; 54 var y = destination.offsetParent.offsetTop + destination.offsetTop + destina tion.offsetHeight / 2;
55 eventSender.mouseMoveTo(x, y); 55 eventSender.mouseMoveTo(x, y);
56 contextMenuElements = eventSender.contextClick(); 56 contextMenuElements = eventSender.contextClick();
57 // Esc key to hide the context menu. 57 // Esc key to hide the context menu.
58 eventSender.keyDown(String.fromCharCode(0x001B), null); 58 eventSender.keyDown("escape", null);
59 59
60 shouldBeEqualToString("window.getSelection().toString()", "home"); 60 shouldBeEqualToString("window.getSelection().toString()", "home");
61 shouldBeEqualToString("contextMenuElements[contextMenuElements.length - 1]", "<separator>"); 61 shouldBeEqualToString("contextMenuElements[contextMenuElements.length - 1]", "<separator>");
62 }); 62 });
63 63
64 </script> 64 </script>
65 </body> 65 </body>
66 </html> 66 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698