Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / editing / spelling / spelling-on-context-menu-key.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
12 <script>
13
14 description("Spell check selects the misspelled word on context menu key. " +
15             "To test manually, type 'wellcome home.' place the cursor on 'wellcome', and press the context menu key. " +
16             "The test succeeds when 'wellcome' is selected after the context menu key.");
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         // Place cursor on "wellcome".
24         window.getSelection().removeAllRanges();
25         var range = document.createRange();
26         range.setStart(textNode, 2);
27         range.setEnd(textNode, 2);
28         window.getSelection().addRange(range);
29
30         // Context menu key to show the context menu.
31         eventSender.keyDown("menu");
32
33         // Esc to close the context menu.
34         eventSender.keyDown("escape");
35
36         shouldBeEqualToString("window.getSelection().toString()", "wellcome");
37     }
38 });
39
40 </script>
41 </body>
42 </html>