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>
9 <p id=
"description"></p>
10 <div id=
"console"></div>
11 <input type=
"week" id=
"input" value=
"2000-W01">
14 description('Test if change event fires when the user selects the default value after the value was changed by JS.');
16 var eventsCounter
= {};
17 function recordEvent(event
) {
18 if (eventsCounter
[event
.type
] === undefined)
19 eventsCounter
[event
.type
] = 0;
20 eventsCounter
[event
.type
]++;
21 debug('==> "' + event
.type
+ '" event was dispatched.');
24 var input
= document
.getElementById('input');
25 input
.addEventListener('input', recordEvent
, false);
26 input
.addEventListener('change', recordEvent
, false);
28 input
.value
= '2000-W02';
30 shouldBeEqualToString('input.value', '2000-W02');
31 shouldBeUndefined('eventsCounter.input');
32 shouldBeUndefined('eventsCounter.change');
34 openPicker(input
, test1
);
37 eventSender
.keyDown('leftArrow');
39 eventSender
.keyDown('\n');
40 shouldBeEqualToString('input.value', '2000-W01');
42 shouldBe('eventsCounter.input', '1');
43 shouldBe('eventsCounter.change', '1');