OLD | NEW |
---|---|
1 <script> | 1 <script> |
2 if (window.testRunner) | 2 if (window.testRunner) |
3 testRunner.dumpAsText(); | 3 testRunner.dumpAsText(); |
4 | 4 |
5 var key = 0; | |
6 function test() | 5 function test() |
7 { | 6 { |
8 if (!window.testRunner) | 7 if (!window.testRunner) |
9 return; | 8 return; |
10 | 9 var elem_focusme = document.getElementById('focusMe'); |
11 var elem = document.getElementById('focusMe') | 10 elem_focusme.focus(); |
12 key = -1; | 11 |
13 elem.focus(); | |
14 eventSender.keyDown("\t"); | 12 eventSender.keyDown("\t"); |
15 | 13 var current_focus = document.activeElement; |
hayato
2014/09/12 04:37:12
You might want to get rid of current_focus variabl
yanagawa
2014/09/12 06:04:48
Done.
| |
16 if (!key) { // first test passed, continue with second test | 14 |
17 key = 1; | 15 if (current_focus == elem_focusme) { // first test passed, continue with sec ond test |
hayato
2014/09/12 04:37:12
This comment doesn't give us much value. You can r
yanagawa
2014/09/12 06:04:48
Done.
| |
18 elem.focus(); | 16 elem_focusme.focus(); |
19 eventSender.keyDown("\t",["shiftKey"]); | 17 eventSender.keyDown("\t",["shiftKey"]); |
18 current_focus = document.activeElement; | |
20 | 19 |
21 if (!key) { // second test passed | 20 if (current_focus == elem_focusme) { // second test passed |
hayato
2014/09/12 04:37:12
Ditto.
yanagawa
2014/09/12 06:04:48
Done.
| |
22 document.write("PASSED"); | 21 document.write("PASSED"); |
hayato
2014/09/12 04:37:12
I am not fan of using document,write() in testing.
yanagawa
2014/09/12 06:04:48
Done.
| |
23 document.close(); | 22 document.close(); |
24 return; | 23 return; |
25 } | 24 } |
26 } | 25 } |
27 document.write("FAILED"); | 26 document.write("FAILED"); |
28 document.close(); | 27 document.close(); |
29 } | 28 } |
30 </script> | 29 </script> |
31 <body onload="test()"> | 30 <body onload="test()"> |
32 <input onfocus="key-=1"> | 31 <input tabindex="-1"> |
33 <input id="focusMe" tabindex="-1"> | 32 <input id="focusMe" tabindex="-1"> |
34 <input onfocus="key+=1"> | 33 <input tabindex="-1"> |
35 <div id="results"></div> | 34 <div id="results"></div> |
hayato
2014/09/12 04:37:12
It seems this #result div is not used.
yanagawa
2014/09/12 06:04:48
Done.
| |
36 </body> | 35 </body> |
OLD | NEW |