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

Side by Side Diff: third_party/WebKit/LayoutTests/editing/spelling/input-type-text.html

Issue 2456473002: Convert input-type-text.html with spellcheck_test (Closed)
Patch Set: Thu Oct 27 11:36:46 JST 2016 Created 4 years, 1 month 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
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../resources/js-test.js"></script>
5 <script src="resources/util.js"></script>
6 </head>
7 <body>
8 <div id="container">
9 <input type="text" id="destination"/>
10 </div>
11
12 <script>
13
14 description("Spell check selects the misspelled word on context click in an inpu t field. " +
15 "To test manually, type 'wellcome home.' and context-click on 'wellc ome'. " +
16 "The test succeeds when 'wellcome' is selected after the context cli ck.");
17
18 initSpellTest("destination", "wellcome home.", function(textNode) {
19 var behaviors = ["win", "mac"];
20 for (var i = 0; i < behaviors.length; i++) {
21 internals.settings.setEditingBehavior(behaviors[i]);
22
23 // Context click on "wellcome" to show the context menu.
24 var x = destination.offsetParent.offsetLeft + destination.offsetLeft + 4 0;
25 var y = destination.offsetParent.offsetTop + destination.offsetTop + des tination.offsetHeight / 2;
26 eventSender.mouseMoveTo(x, y);
27 eventSender.contextClick();
28 // Esc key to hide the context menu.
29 eventSender.keyDown("Escape", null);
30
31 shouldBeEqualToString("window.getSelection().toString()", "wellcome");
32 window.getSelection().removeAllRanges();
33
34 // Context click on "home" to show the context menu.
35 var x = destination.offsetParent.offsetLeft + destination.offsetLeft + 8 0;
36 var y = destination.offsetParent.offsetTop + destination.offsetTop + des tination.offsetHeight / 2;
37 eventSender.mouseMoveTo(x, y);
38 eventSender.contextClick();
39 // Esc key to hide the context menu.
40 eventSender.keyDown("Escape", null);
41
42 // Context click should select correctly spelled words only with "win" e diting behavior.
43 if (behaviors[i] == "mac")
44 shouldBeEqualToString("window.getSelection().toString()", "home");
45 else
46 shouldBeEqualToString("window.getSelection().toString()", "");
47 window.getSelection().removeAllRanges();
48 }
49 });
50
51 </script>
52 </body>
53 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698