Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / forms / calendar-picker / month-picker-choose-default-value-after-set-value.html
blob6dabc09b6b235b5efcbcdf50ce6f2ce61e547832
1 <!DOCTYPE html>
2 <html>
3 <head>
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 </head>
8 <body>
9 <p id="description"></p>
10 <div id="console"></div>
11 <input type="month" id="input" value="2000-01">
13 <script>
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-02';
30 shouldBeEqualToString('input.value', '2000-02');
31 shouldBeUndefined('eventsCounter.input');
32 shouldBeUndefined('eventsCounter.change');
34 openPicker(input, test1);
36 function test1() {
37 eventSender.keyDown('leftArrow');
38 removeCommitDelay();
39 eventSender.keyDown('\n');
40 shouldBeEqualToString('input.value', '2000-01');
42 shouldBe('eventsCounter.input', '1');
43 shouldBe('eventsCounter.change', '1');
45 finishJSTest();
47 </script>
48 </body>
49 </html>