4 <script src=
"../../../resources/js-test.js"></script>
5 <script src=
"../../forms/resources/picker-common.js"></script>
6 <script src=
"resources/calendar-picker-common.js"></script>
7 <p id=
"description"></p>
8 <div id=
"console"></div>
9 <input type=
"date" id=
"date1" value=
"2000-01-02">
12 description('Tests if typing an arrow key dispatches |Focus| and |ActiveDescendantChanged| a11y events.');
14 window
.accessibilityController
.setNotificationListener(function(axnode
, type
) {
15 if (type
== 'Focus') {
16 // Remove ',' to reduce platform differences.
17 debug('Focused: ' + escapeHTML(accessibilityController
.focusedElement
.description
.replace(/,/g
, '')));
18 } else if (type
== 'ActiveDescendantChanged') {
19 testPassed('Received ActiveDescendantChanged');
20 if (++activeDescendantCounter
== 2) {
21 testButtonDescription();
22 } else if (activeDescendantCounter
== 3) {
23 // Highlight 2000-02 in the month popup.
24 setTimeout(function() { eventSender
.keyDown('rightArrow'); }, 0);
25 } else if (activeDescendantCounter
== 4) {
26 // Highlight 1999-10 in the month popup.
27 setTimeout(function() { eventSender
.keyDown('upArrow'); }, 0);
28 } else if (activeDescendantCounter
== 5) {
33 var activeDescendantCounter
= 0;
34 var date1
= document
.getElementById('date1');
35 openPicker(date1
, test1
);
38 eventSender
.keyDown('rightArrow');
41 function testButtonDescription() {
42 // Focus on 'next month' button.
43 eventSender
.keyDown('\t', ['shiftKey']);
44 // Focus on the today button.
45 eventSender
.keyDown('\t', ['shiftKey']);
46 // Focus on 'previous month' button.
47 eventSender
.keyDown('\t', ['shiftKey']);
48 // Focus on the month selector button.
49 eventSender
.keyDown('\t', ['shiftKey']);
51 debug('Open the month popup. This should notify the third ActiveDescendantChanged.');
52 eventSender
.keyDown(' ');