Index: LayoutTests/fast/forms/date-multiple-fields/date-multiple-fields-focusin-event.html |
diff --git a/LayoutTests/fast/forms/date-multiple-fields/date-multiple-fields-focusin-event.html b/LayoutTests/fast/forms/date-multiple-fields/date-multiple-fields-focusin-event.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..519cef955c3a7323816ed19f9d75825ed7d4347a |
--- /dev/null |
+++ b/LayoutTests/fast/forms/date-multiple-fields/date-multiple-fields-focusin-event.html |
@@ -0,0 +1,47 @@ |
+<!DOCTYPE html> |
+<script src="../../../resources/js-test.js"></script> |
+<body> |
+<form> |
+<input type="text" id="text"> |
+<input type="date" id="date"> |
+<input type="time" id="time"> |
+</form> |
+<script> |
+description('Test Date/Time input field dispatches focusin event when pressed tab'); |
+var dispatchedFocusInEvent = 0; |
+var dispatchedDOMFocusInEvent = 0; |
+ |
+document.documentElement.addEventListener('focusin', focusin, false); |
+document.documentElement.addEventListener('DOMFocusIn', domfocusin, false); |
+ |
+function focusin() |
+{ |
+ dispatchedFocusInEvent++; |
+} |
+ |
+function domfocusin() |
+{ |
+ dispatchedDOMFocusInEvent++; |
+} |
+ |
+document.getElementById('text').focus(); |
+shouldBeEqualToString('document.activeElement.id', 'text'); |
+shouldBe('dispatchedFocusInEvent', '1'); |
+shouldBe('dispatchedDOMFocusInEvent', '1'); |
+ |
+debug('Move to date field, should generate foucsin event'); |
+eventSender.keyDown('\t'); // move to date input element. |
+shouldBeEqualToString('document.activeElement.id', 'date'); |
+shouldBe('dispatchedFocusInEvent', '2'); |
+shouldBe('dispatchedDOMFocusInEvent', '2'); |
+eventSender.keyDown('\t'); // move to date field. |
+eventSender.keyDown('\t'); // move to year field. |
+ |
+debug('Move to time field, should generate foucsin event'); |
+eventSender.keyDown('\t'); // move to time field. |
+shouldBeEqualToString('document.activeElement.id', 'time'); |
+shouldBe('dispatchedFocusInEvent', '3'); |
+shouldBe('dispatchedDOMFocusInEvent', '3'); |
+ |
+</script> |
+</body> |