[WK2] selection does not disappear after coping the text
[framework/web/webkit-efl.git] / LayoutTests / fast / events / keydown-leftright-keys.html
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <script src="../js/resources/js-test-pre.js"></script>
5 </head>
6 <body>
7 <script>
8 description("This tests keyboard events with KeyLocationCode argument.");
9
10 var lastKeyboardEvent;
11 var VK_SHIFT = 16;
12 var VK_CONTROL = 17;
13 var VK_MENU = 18;
14 var KEY_LOCATION_LEFT = 1;
15 var KEY_LOCATION_RIGHT = 2;
16
17 function recordKeyEvent(ev) {
18     ev = ev || event;
19     ev.keyCode = (ev.which || ev.keyCode);
20     if (window.eventSender) {
21         lastKeyboardEvent = ev;
22     } else {
23         debug('Type=' + ev.type + ',' +
24               'keyCode=' + ev.keyCode + ',' +
25               'ctrlKey=' + ev.ctrlKey + ',' +
26               'shiftKey=' + ev.shiftKey + ',' +
27               'altKey=' + ev.altKey + ',' +
28               'metaKey=' + ev.metaKey + ',' +
29               'location=' + ev.keyLocation);
30     }
31 }
32
33 function testKeyEventWithLocation(evString, expectedKeyCode, expectedLocation) {
34     eventSender.keyDown(evString, []);
35     shouldBe("lastKeyboardEvent.type", '"keydown"');
36     shouldEvaluateTo("lastKeyboardEvent.keyCode", expectedKeyCode);
37     shouldEvaluateTo("lastKeyboardEvent.keyLocation", expectedLocation);
38 }
39
40 var textarea = document.createElement("textarea");
41 textarea.addEventListener("keydown", recordKeyEvent, false);
42 document.body.insertBefore(textarea, document.body.firstChild);
43 textarea.focus();
44
45 if (window.eventSender) {
46     // location=0 indicates that we send events as standard keys.
47     testKeyEventWithLocation("leftShift", VK_SHIFT, "KEY_LOCATION_LEFT");
48     testKeyEventWithLocation("leftControl", VK_CONTROL, "KEY_LOCATION_LEFT");
49     testKeyEventWithLocation("leftAlt", VK_MENU, "KEY_LOCATION_LEFT");
50
51     testKeyEventWithLocation("rightShift", VK_SHIFT, "KEY_LOCATION_RIGHT");
52     testKeyEventWithLocation("rightControl", VK_CONTROL, "KEY_LOCATION_RIGHT");
53     testKeyEventWithLocation("rightAlt", VK_MENU, "KEY_LOCATION_RIGHT");
54 } else {
55     debug("This test requires DumpRenderTree.");
56 }
57 </script>
58 <script src="../js/resources/js-test-post.js"></script>
59 </body>
60 </html>