OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src="../../../resources/js-test.js"></script> |
| 3 <body> |
| 4 <form> |
| 5 <input type="text" id="text"> |
| 6 <input type="date" id="date"> |
| 7 <input type="time" id="time"> |
| 8 </form> |
| 9 <script> |
| 10 description('Test Date/Time input field dispatches focusin event when pressed ta
b'); |
| 11 var dispatchedFocusInEvent = 0; |
| 12 var dispatchedDOMFocusInEvent = 0; |
| 13 |
| 14 document.documentElement.addEventListener('focusin', focusin, false); |
| 15 document.documentElement.addEventListener('DOMFocusIn', domfocusin, false); |
| 16 |
| 17 function focusin() |
| 18 { |
| 19 dispatchedFocusInEvent++; |
| 20 } |
| 21 |
| 22 function domfocusin() |
| 23 { |
| 24 dispatchedDOMFocusInEvent++; |
| 25 } |
| 26 |
| 27 document.getElementById('text').focus(); |
| 28 shouldBeEqualToString('document.activeElement.id', 'text'); |
| 29 shouldBe('dispatchedFocusInEvent', '1'); |
| 30 shouldBe('dispatchedDOMFocusInEvent', '1'); |
| 31 |
| 32 debug('Move to date field, should generate foucsin event'); |
| 33 eventSender.keyDown('\t'); // move to date input element. |
| 34 shouldBeEqualToString('document.activeElement.id', 'date'); |
| 35 shouldBe('dispatchedFocusInEvent', '2'); |
| 36 shouldBe('dispatchedDOMFocusInEvent', '2'); |
| 37 eventSender.keyDown('\t'); // move to date field. |
| 38 eventSender.keyDown('\t'); // move to year field. |
| 39 |
| 40 debug('Move to time field, should generate foucsin event'); |
| 41 eventSender.keyDown('\t'); // move to time field. |
| 42 shouldBeEqualToString('document.activeElement.id', 'time'); |
| 43 shouldBe('dispatchedFocusInEvent', '3'); |
| 44 shouldBe('dispatchedDOMFocusInEvent', '3'); |
| 45 |
| 46 </script> |
| 47 </body> |
OLD | NEW |