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

Side by Side Diff: LayoutTests/editing/spelling/spelling-should-select-single-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 12 matching lines...) Expand all
23 spellingMarkerRange = internals.markerRangeForNode(textNode, "spelling", 0); 23 spellingMarkerRange = internals.markerRangeForNode(textNode, "spelling", 0);
24 shouldBeEqualToString("spellingMarkerRange.toString()", "wellcome"); 24 shouldBeEqualToString("spellingMarkerRange.toString()", "wellcome");
25 shouldBeEqualToString("window.getSelection().toString()", ""); 25 shouldBeEqualToString("window.getSelection().toString()", "");
26 26
27 // Context click on "wellcome" to show the context menu. 27 // Context click on "wellcome" to show the context menu.
28 var x = destination.offsetParent.offsetLeft + destination.offsetLeft + 4 0; 28 var x = destination.offsetParent.offsetLeft + destination.offsetLeft + 4 0;
29 var y = destination.offsetParent.offsetTop + destination.offsetTop + des tination.offsetHeight / 2; 29 var y = destination.offsetParent.offsetTop + destination.offsetTop + des tination.offsetHeight / 2;
30 eventSender.mouseMoveTo(x, y); 30 eventSender.mouseMoveTo(x, y);
31 contextMenuElements = eventSender.contextClick(); 31 contextMenuElements = eventSender.contextClick();
32 // Esc key to hide the context menu. 32 // Esc key to hide the context menu.
33 eventSender.keyDown(String.fromCharCode(0x001B), null); 33 eventSender.keyDown("escape", null);
34 34
35 spellingMarkerRange = internals.markerRangeForNode(textNode, "spelling", 0); 35 spellingMarkerRange = internals.markerRangeForNode(textNode, "spelling", 0);
36 shouldBeEqualToString("spellingMarkerRange.toString()", "wellcome"); 36 shouldBeEqualToString("spellingMarkerRange.toString()", "wellcome");
37 shouldBeEqualToString("window.getSelection().toString()", "wellcome"); 37 shouldBeEqualToString("window.getSelection().toString()", "wellcome");
38 shouldBeEqualToString("contextMenuElements[contextMenuElements.length - 1]", "welcome"); 38 shouldBeEqualToString("contextMenuElements[contextMenuElements.length - 1]", "welcome");
39 39
40 window.getSelection().removeAllRanges(); 40 window.getSelection().removeAllRanges();
41 shouldBeEqualToString("window.getSelection().toString()", ""); 41 shouldBeEqualToString("window.getSelection().toString()", "");
42 42
43 // Context click on "home" to show the context menu. 43 // Context click on "home" to show the context menu.
44 var x = destination.offsetParent.offsetLeft + destination.offsetLeft + 8 0; 44 var x = destination.offsetParent.offsetLeft + destination.offsetLeft + 8 0;
45 var y = destination.offsetParent.offsetTop + destination.offsetTop + des tination.offsetHeight / 2; 45 var y = destination.offsetParent.offsetTop + destination.offsetTop + des tination.offsetHeight / 2;
46 eventSender.mouseMoveTo(x, y); 46 eventSender.mouseMoveTo(x, y);
47 contextMenuElements = eventSender.contextClick(); 47 contextMenuElements = eventSender.contextClick();
48 // Esc key to hide the context menu. 48 // Esc key to hide the context menu.
49 eventSender.keyDown(String.fromCharCode(0x001B), null); 49 eventSender.keyDown("escape", null);
50 50
51 // Context click should select correctly spelled words only with "win" e diting behavior. 51 // Context click should select correctly spelled words only with "win" e diting behavior.
52 if (behaviors[i] == "mac") 52 if (behaviors[i] == "mac")
53 shouldBeEqualToString("window.getSelection().toString()", "home"); 53 shouldBeEqualToString("window.getSelection().toString()", "home");
54 else 54 else
55 shouldBeEqualToString("window.getSelection().toString()", ""); 55 shouldBeEqualToString("window.getSelection().toString()", "");
56 shouldBeEqualToString("contextMenuElements[contextMenuElements.length - 1]", "<separator>"); 56 shouldBeEqualToString("contextMenuElements[contextMenuElements.length - 1]", "<separator>");
57 57
58 window.getSelection().removeAllRanges(); 58 window.getSelection().removeAllRanges();
59 } 59 }
60 }); 60 });
61 61
62 </script> 62 </script>
63 </body> 63 </body>
64 </html> 64 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698