Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / forms / week-multiple-fields / week-multiple-fields-choose-default-value-after-set-value.html
blob1c511ccba56f9e5183f3a5fe13256a22c0c774ad
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../../resources/js-test.js"></script>
5 <script src="../resources/common.js"></script>
6 </head>
7 <body>
8 <p id="description"></p>
9 <div id="console"></div>
10 <input type="week" id="input" value="2000-W01">
11 <script>
12 description('Test if change event fires when the user selects the default value after the value was changed by JS.');
14 var eventsCounter = {};
15 function recordEvent(event) {
16 if (eventsCounter[event.type] === undefined)
17 eventsCounter[event.type] = 0;
18 eventsCounter[event.type]++;
19 debug('==> "' + event.type + '" event was dispatched.');
22 var input = document.getElementById('input');
23 input.addEventListener('input', recordEvent, false);
24 input.addEventListener('change', recordEvent, false);
26 input.value = '2001-W01';
28 shouldBeEqualToString('input.value', '2001-W01');
29 shouldBeUndefined('eventsCounter.input');
30 shouldBeUndefined('eventsCounter.change');
32 // We assume the date format is Week ww, yyyy.
34 input.focus();
35 eventSender.keyDown('rightArrow');
36 eventSender.keyDown('downArrow');
38 shouldBeEqualToString('input.value', '2000-W01');
39 shouldBe('eventsCounter.input', '1');
40 shouldBe('eventsCounter.change', '1');
42 </script>
43 </body>
44 </html>