OLD | NEW |
| (Empty) |
1 <html> | |
2 <head> | |
3 <title></title> | |
4 <script type="text/javascript"> | |
5 var changeCount = new Array(4); | |
6 changeCount[1] = changeCount[2] = changeCount[3] = 0; | |
7 | |
8 function test() | |
9 { | |
10 if (!window.eventSender) | |
11 return; | |
12 | |
13 testRunner.dumpAsText(); | |
14 | |
15 var popup = document.getElementById("switcher1"); | |
16 popup.focus(); | |
17 | |
18 popup = document.getElementById("switcher2"); | |
19 popup.focus(); | |
20 | |
21 eventSender.keyDown("t", null); | |
22 eventSender.keyDown("\r", null); | |
23 | |
24 var popup = document.getElementById("switcher3"); | |
25 popup.focus(); | |
26 | |
27 check(); | |
28 } | |
29 | |
30 function check() { | |
31 setTimeout("document.getElementById('switcher3').selectedIndex =
1;", 0); | |
32 | |
33 var popup = document.getElementById("switcher2"); | |
34 popup.focus(); | |
35 | |
36 var result = document.getElementById("result"); | |
37 result.innerHTML = ""; | |
38 if (changeCount[1] != 0) { | |
39 result.innerHTML += "<br/>FAILURE: onchange(1) called " + ch
angeCount[1] + " times."; | |
40 } | |
41 if (changeCount[2] != 1) { | |
42 result.innerHTML += "<br/>FAILURE: onchange(2) called " + ch
angeCount[2] + " times."; | |
43 } | |
44 if (changeCount[3] != 0) { | |
45 result.innerHTML += "<br/>FAILURE: onchange(3) called " + ch
angeCount[3] + " times."; | |
46 } | |
47 if (result.innerHTML == "") result.innerHTML = "SUCCESS"; | |
48 | |
49 } | |
50 | |
51 function changed(select) | |
52 { | |
53 changeCount[select]++; | |
54 } | |
55 </script> | |
56 </head> | |
57 <body onload="test()"> | |
58 <p> | |
59 Test for <i><a href="http://bugs.webkit.org/show_bug.cgi?id=23721">h
ttp://bugs.webkit.org/show_bug.cgi?id=23721</a> | |
60 Changing dropdown's selectedIndex within onchange handler fires anot
her onchange</i>. | |
61 </p> | |
62 <p id="result"> | |
63 To test interactively: focus on the first select (don't change it).<br
/> | |
64 Change the second select to "two"<br/> | |
65 Focus on the third, then click <a href="#" onclick="check(); return fa
lse;">here</a>. | |
66 </p> | |
67 This select changes on focus: should not fire onchange. | |
68 <select name="switcher1" id="switcher1" onfocus="this.selectedIndex = 1;
" onchange="changed(1)"> | |
69 <option value="one">One</option> | |
70 <option value="two">Two</option> | |
71 </select> | |
72 <hr/> | |
73 This select changes on change: should only fire onchange once. | |
74 <select name="switcher2" id="switcher2" onchange="changed(2); if (this.s
electedIndex == 1) this.selectedIndex = 2;"> | |
75 <option value="one">One</option> | |
76 <option value="two">Two</option> | |
77 <option value="three">Three</option> | |
78 </select> | |
79 <hr/> | |
80 This select is changed by a timeout in the test script. It should not f
ire onchange. | |
81 <select name="switcher3" id="switcher3" onchange="changed(3)"> | |
82 <option value="one">One</option> | |
83 <option value="two">Two</option> | |
84 </select> | |
85 </body> | |
86 </html> | |
OLD | NEW |