Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Unified Diff: LayoutTests/fast/forms/date-multiple-fields/date-multiple-fields-focusin-event.html

Issue 541993003: Generate focusin for input type=date/time when selected by tab (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updated tests and removed handleFocusInEvent handler Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..3358d61bfc852998064ab76ae6802857a235aaeb
--- /dev/null
+++ b/LayoutTests/fast/forms/date-multiple-fields/date-multiple-fields-focusin-event.html
@@ -0,0 +1,51 @@
+<!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 input = document.querySelector('input');
tkent 2014/09/11 23:52:54 This is not used.
Habib Virji 2014/09/12 08:18:25 Done.
+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
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.
+shouldBeEqualToString('document.activeElement.id', 'date');
+shouldBe('dispatchedFocusInEvent', '2');
+shouldBe('dispatchedDOMFocusInEvent', '2');
+eventSender.keyDown('\t'); //move to date field
tkent 2014/09/11 23:52:54 Ditto.
Habib Virji 2014/09/12 08:18:25 Done.
+eventSender.keyDown('\t'); //move to year field
tkent 2014/09/11 23:52:54 Ditto.
Habib Virji 2014/09/12 08:18:25 Done.
+
+debug('Move to time field, should generate foucsin event');
+eventSender.keyDown('\t'); //move to time field
tkent 2014/09/11 23:52:54 Ditto.
Habib Virji 2014/09/12 08:18:25 Done.
+shouldBeEqualToString('document.activeElement.id', 'time');
+shouldBe('dispatchedFocusInEvent', '3');
+shouldBe('dispatchedDOMFocusInEvent', '3');
+
+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.
+eventSender.keyDown('\t'); //move to am/pm field
+
+</script>
+</body>

Powered by Google App Engine
This is Rietveld 408576698