4 <script src="../../resources/js-test.js"></script>
5 <script src="resources/util.js"></script>
9 <input type="text" id="destination"/>
14 description("Spell check selects the misspelled word on context click in an input field. " +
15 "To test manually, type 'wellcome home.' and context-click on 'wellcome'. " +
16 "The test succeeds when 'wellcome' is selected after the context click.");
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]);
23 // Context click on "wellcome" to show the context menu.
24 var x = destination.offsetParent.offsetLeft + destination.offsetLeft + 40;
25 var y = destination.offsetParent.offsetTop + destination.offsetTop + destination.offsetHeight / 2;
26 eventSender.mouseMoveTo(x, y);
27 eventSender.contextClick();
28 // Esc key to hide the context menu.
29 eventSender.keyDown("escape", null);
31 shouldBeEqualToString("window.getSelection().toString()", "wellcome");
32 window.getSelection().removeAllRanges();
34 // Context click on "home" to show the context menu.
35 var x = destination.offsetParent.offsetLeft + destination.offsetLeft + 80;
36 var y = destination.offsetParent.offsetTop + destination.offsetTop + destination.offsetHeight / 2;
37 eventSender.mouseMoveTo(x, y);
38 eventSender.contextClick();
39 // Esc key to hide the context menu.
40 eventSender.keyDown("escape", null);
42 // Context click should select correctly spelled words only with "win" editing behavior.
43 if (behaviors[i] == "mac")
44 shouldBeEqualToString("window.getSelection().toString()", "home");
46 shouldBeEqualToString("window.getSelection().toString()", "");
47 window.getSelection().removeAllRanges();