4 <script src=
"../../resources/js-test.js"></script>
5 <script src=
"resources/util.js"></script>
9 <div id=
"destination" contentEditable
></div>
13 description("Spell check should select multi-word misspellings on context click. "+
14 "To test manually, enable 'Ask Google for Suggestions' in Chrome, type 'It should be upper case.', and context-click on the word 'upper'. " +
15 "The test succeeds when 'upper case' was selected after context click.");
17 initSpellTest("destination", "It should be upper case.", function(textNode
) {
18 var behaviors
= ["win", "mac"];
19 for (var i
= 0; i
< behaviors
.length
; i
++) {
20 internals
.settings
.setEditingBehavior(behaviors
[i
]);
22 spellingMarkerRange
= internals
.markerRangeForNode(textNode
, "spelling", 0);
23 shouldBeEqualToString("spellingMarkerRange.toString()", "upper case");
24 shouldBeEqualToString("window.getSelection().toString()", "");
26 // Context click on "upper case" to show the context menu.
27 var x
= destination
.offsetParent
.offsetLeft
+ destination
.offsetLeft
+ 100;
28 var y
= destination
.offsetParent
.offsetTop
+ destination
.offsetTop
+ destination
.offsetHeight
/ 2;
29 eventSender
.mouseMoveTo(x
, y
);
30 contextMenuElements
= eventSender
.contextClick();
31 // Esc key to hide the context menu.
32 eventSender
.keyDown("escape", null);
34 spellingMarkerRange
= internals
.markerRangeForNode(textNode
, "spelling", 0);
35 shouldBeEqualToString("spellingMarkerRange.toString()", "upper case");
36 shouldBeEqualToString("window.getSelection().toString()", "upper case");
37 shouldBeEqualToString("contextMenuElements[contextMenuElements.length - 1]", "uppercase");
39 window
.getSelection().removeAllRanges();