OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <script src="../../../fast/js/resources/js-test-pre.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="time" id="input" value="01:01:01"> |
| 11 <script> |
| 12 description('Test if change event fires when the user selects the default value
after the value was changed by JS.'); |
| 13 |
| 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.'); |
| 20 } |
| 21 |
| 22 var input = document.getElementById('input'); |
| 23 input.addEventListener('input', recordEvent, false); |
| 24 input.addEventListener('change', recordEvent, false); |
| 25 |
| 26 input.value = '02:01:01'; |
| 27 |
| 28 shouldBeEqualToString('input.value', '02:01:01'); |
| 29 shouldBeUndefined('eventsCounter.input'); |
| 30 shouldBeUndefined('eventsCounter.change'); |
| 31 |
| 32 // We assume the date format is h:m a. |
| 33 |
| 34 input.focus(); |
| 35 eventSender.keyDown('downArrow'); |
| 36 |
| 37 shouldBeEqualToString('input.value', '01:01:01'); |
| 38 shouldBe('eventsCounter.input', '1'); |
| 39 shouldBe('eventsCounter.change', '1'); |
| 40 |
| 41 </script> |
| 42 <script src="../../../fast/js/resources/js-test-post.js"></script> |
| 43 </body> |
| 44 </html> |
OLD | NEW |