OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <body> | 2 <body> |
3 <style> | 3 <style> |
4 button:disabled { | 4 button:disabled { |
5 color: #aaa; | 5 color: #aaa; |
6 } | 6 } |
7 button { | 7 button { |
8 -webkit-appearance: none; | 8 -webkit-appearance: none; |
9 } | 9 } |
10 </style> | 10 </style> |
11 <button autofocus onclick="this.disabled = true;">Button</button> | 11 <button autofocus onclick="this.disabled = true;">Button</button> |
12 <script src="../../js/resources/js-test-pre.js"></script> | 12 <script src="../../../resources/js-test.js"></script> |
13 <script> | 13 <script> |
14 jsTestIsAsync = true; | 14 jsTestIsAsync = true; |
15 var button = document.querySelector('button'); | 15 var button = document.querySelector('button'); |
16 shouldBe('document.activeElement', 'button'); | 16 shouldBe('document.activeElement', 'button'); |
17 debug('Clicking a button makes the button disabled.'); | 17 debug('Clicking a button makes the button disabled.'); |
18 window.onload = function() { | 18 window.onload = function() { |
19 button.addEventListener('blur', function() { | 19 button.addEventListener('blur', function() { |
20 testPassed('blur event was disaptched.'); | 20 testPassed('blur event was disaptched.'); |
21 button.remove(); | 21 button.remove(); |
22 finishJSTest(); | 22 finishJSTest(); |
23 }, false); | 23 }, false); |
24 // Need to wait until CheckFocusedElementTask is unqueued. | 24 // Need to wait until CheckFocusedElementTask is unqueued. |
25 setTimeout(function() { | 25 setTimeout(function() { |
26 button.click(); | 26 button.click(); |
27 }, 20); | 27 }, 20); |
28 setTimeout(function() { | 28 setTimeout(function() { |
29 testFailed('No blur event.'); | 29 testFailed('No blur event.'); |
30 finishJSTest(); | 30 finishJSTest(); |
31 }, 2000); | 31 }, 2000); |
32 }; | 32 }; |
33 </script> | 33 </script> |
34 </body> | 34 </body> |
OLD | NEW |