[WK2] selection does not disappear after coping the text
[framework/web/webkit-efl.git] / LayoutTests / fast / events / onchange-select-popup.html
1 <html>
2 <head>
3     <script>
4     function log(s)
5     {
6         document.getElementById('console').appendChild(document.createTextNode(s + "\n"));
7     }
8
9     function changeHandler()
10     {
11         log ('PASS: change event fired.\n');
12     }
13
14     function blurHandler()
15     {
16         log ('blur event fired.\n');
17     }
18
19     function test()
20     {
21         if (window.layoutTestController)
22             layoutTestController.dumpAsText();
23         
24         // Test for select that's not inside a form element
25         var menu1 = document.getElementById('menu1');
26         menu1.focus();
27
28         if (window.layoutTestController) {
29             // change the option selection
30             eventSender.keyDown('e');
31         }
32         // hit enter
33         var enterEvent = document.createEvent("KeyboardEvents");
34         enterEvent.initKeyboardEvent("keypress", true, false, window, "Enter", 0, false, false, false, false, false);
35         menu1.dispatchEvent(enterEvent);
36         
37         // Test for select is inside a form element
38         var menu2 = document.getElementById('menu2');
39         menu2.focus();
40
41         if (window.layoutTestController) {
42             // change the option selection
43             eventSender.keyDown('e');
44         }
45         // hit enter
46         menu2.dispatchEvent(enterEvent);
47     }
48     </script>
49 </head>
50 <body onload="test()">
51     <p>This test verifies that the ENTER key fires the change event for popups.</p>
52     <hr>
53     <select id="menu1" onchange="changeHandler()" onblur="blurHandler()"><option>abcd</option><option>efgh</option></select>
54     <form onsubmit="return false;">
55         <select id="menu2" onchange="changeHandler()" onblur="blurHandler()"><option>abcd</option><option>efgh</option></select>
56     </form>
57     <pre id="console"></pre>
58 </body>
59 </html>