Chromium Code Reviews| 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 input = document.querySelector('input'); | |
|
tkent
2014/09/11 23:52:54
This is not used.
Habib Virji
2014/09/12 08:18:25
Done.
| |
| 12 var dispatchedFocusInEvent = 0; | |
| 13 var dispatchedDOMFocusInEvent = 0; | |
| 14 | |
| 15 document.documentElement.addEventListener('focusin', focusin, false); | |
| 16 document.documentElement.addEventListener('DOMFocusIn', domfocusin, false); | |
| 17 | |
| 18 function focusin() | |
| 19 { | |
| 20 dispatchedFocusInEvent++; | |
| 21 } | |
| 22 | |
| 23 function domfocusin() | |
| 24 { | |
| 25 dispatchedDOMFocusInEvent++; | |
| 26 } | |
| 27 | |
| 28 document.getElementById('text').focus(); | |
| 29 shouldBeEqualToString('document.activeElement.id', 'text'); | |
| 30 shouldBe('dispatchedFocusInEvent', '1'); | |
| 31 shouldBe('dispatchedDOMFocusInEvent', '1'); | |
| 32 | |
| 33 debug('Move to date field, should generate foucsin event'); | |
| 34 eventSender.keyDown('\t'); //move to date input element | |
|
tkent
2014/09/11 23:52:54
Add space after //.
Add period at the end of the c
Habib Virji
2014/09/12 08:18:25
Done.
| |
| 35 shouldBeEqualToString('document.activeElement.id', 'date'); | |
| 36 shouldBe('dispatchedFocusInEvent', '2'); | |
| 37 shouldBe('dispatchedDOMFocusInEvent', '2'); | |
| 38 eventSender.keyDown('\t'); //move to date field | |
|
tkent
2014/09/11 23:52:54
Ditto.
Habib Virji
2014/09/12 08:18:25
Done.
| |
| 39 eventSender.keyDown('\t'); //move to year field | |
|
tkent
2014/09/11 23:52:54
Ditto.
Habib Virji
2014/09/12 08:18:25
Done.
| |
| 40 | |
| 41 debug('Move to time field, should generate foucsin event'); | |
| 42 eventSender.keyDown('\t'); //move to time field | |
|
tkent
2014/09/11 23:52:54
Ditto.
Habib Virji
2014/09/12 08:18:25
Done.
| |
| 43 shouldBeEqualToString('document.activeElement.id', 'time'); | |
| 44 shouldBe('dispatchedFocusInEvent', '3'); | |
| 45 shouldBe('dispatchedDOMFocusInEvent', '3'); | |
| 46 | |
| 47 eventSender.keyDown('\t'); //move to hour field | |
|
tkent
2014/09/11 23:52:54
Ditto.
If you don't check resultant dispatchedFoc
Habib Virji
2014/09/12 08:18:25
Done.
| |
| 48 eventSender.keyDown('\t'); //move to am/pm field | |
| 49 | |
| 50 </script> | |
| 51 </body> | |
| OLD | NEW |