Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / forms / text / text-reset-click-delete-text-change-event.html
blob4ba398b9e9048d37c8932e9b72535cad2522768b
1 <!DOCTYPE>
2 <html>
3 <body>
4 <script src="../resources/common.js"></script>
5 <script src="../../../resources/js-test.js"></script>
6 <input type="textfield" id="text" onchange="handleChangeEvent(this);" value="value">
7 <input type="reset" id="reset">
8 <script>
9 description('In a text field after reset when whole text is deleted i.e. text value is empty. When out of focus, it should dispatch change event');
11 var changeEventCounter = 0;
13 function handleChangeEvent(element) {
14 ++changeEventCounter;
17 var reset = document.getElementById('reset');
18 var text = document.getElementById('text');
20 debug('Press reset button');
21 clickElement(reset);
23 text.focus();
24 shouldBeEqualToString('text.value', 'value');
25 shouldBe('changeEventCounter', '0');
27 debug('Delete the whole text');
28 document.execCommand('SelectAll', false, null);
29 document.execCommand('Delete', false, null);
31 debug('Out of focus from text field');
32 reset.focus();
33 shouldBeEqualToString('text.value', '');
34 shouldBe('changeEventCounter', '1');
36 </script>
37 </body>
38 </html>