2 <script src=
"../../../resources/js-test.js"></script>
5 <input type=
"text" id=
"text">
6 <input type=
"date" id=
"date">
7 <input type=
"time" id=
"time">
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);
19 dispatchedFocusInEvent
++;
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');