OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <script src="../../resources/js-test.js"></script> |
| 5 </head> |
| 6 <body> |
| 7 <input id="input" type="text" onchange="changeHandler()"> |
| 8 <script> |
| 9 description('This test verifies that the change event is fired, when value is ch
anged in change event handler.'); |
| 10 var input = document.getElementById('input'); |
| 11 var changeEventCounter = 0; |
| 12 function changeHandler() |
| 13 { |
| 14 changeEventCounter++; |
| 15 input.value = ''; |
| 16 } |
| 17 |
| 18 input.focus(); |
| 19 document.execCommand('InsertText', false, 'foo bar baz'); |
| 20 shouldBeEqualToString('input.value', 'foo bar baz'); |
| 21 input.blur(); |
| 22 shouldBe('changeEventCounter', '1'); |
| 23 shouldBeEqualToString('input.value', ''); |
| 24 |
| 25 input.focus(); |
| 26 document.execCommand('InsertText', false, 'foo bar baz'); |
| 27 shouldBeEqualToString('input.value', 'foo bar baz'); |
| 28 input.blur(); |
| 29 shouldBe('changeEventCounter', '2'); |
| 30 </script> |
| 31 </body> |
| 32 </html> |
OLD | NEW |