Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / forms / date-multiple-fields / date-multiple-fields-focusin-event.html
blob519cef955c3a7323816ed19f9d75825ed7d4347a
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 tab');
11 var dispatchedFocusInEvent = 0;
12 var dispatchedDOMFocusInEvent = 0;
14 document.documentElement.addEventListener('focusin', focusin, false);
15 document.documentElement.addEventListener('DOMFocusIn', domfocusin, false);
17 function focusin()
19 dispatchedFocusInEvent++;
22 function domfocusin()
24 dispatchedDOMFocusInEvent++;
27 document.getElementById('text').focus();
28 shouldBeEqualToString('document.activeElement.id', 'text');
29 shouldBe('dispatchedFocusInEvent', '1');
30 shouldBe('dispatchedDOMFocusInEvent', '1');
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.
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');
46 </script>
47 </body>