Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / editing / spelling / spelling-should-select-multiple-words.html
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   <div id="destination" contentEditable></div>
10 </div>
11 <script>
12
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.");
16
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]);
21
22         spellingMarkerRange = internals.markerRangeForNode(textNode, "spelling", 0);
23         shouldBeEqualToString("spellingMarkerRange.toString()", "upper case");
24         shouldBeEqualToString("window.getSelection().toString()", "");
25
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);
33
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");
38
39         window.getSelection().removeAllRanges();
40     }
41 });
42
43 </script>
44 </body>
45 </html>