| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src='../../resources/testharness.js'></script> |
| 3 <script src='../../resources/testharnessreport.js'></script> |
| 4 <style> |
| 5 input { background-color: black; } |
| 6 input:active { background-color: red; } |
| 7 </style> |
| 8 <div id="sandbox"> |
| 9 <input id="i1" type="button"><input id="i2" type="button"> |
| 10 </div> |
| 11 <script> |
| 12 if (window.eventSender) { |
| 13 test(() => { |
| 14 var i1 = document.querySelector('#i1'); |
| 15 var x = i1.offsetLeft + i1.offsetWidth / 2; |
| 16 var y = i1.offsetTop + i1.offsetHeight / 2; |
| 17 eventSender.mouseMoveTo(x, y); |
| 18 |
| 19 var i2 = document.querySelector('#i2'); |
| 20 |
| 21 assert_equals(getComputedStyle(i1).backgroundColor, 'rgb(0, 0, 0)'); |
| 22 assert_equals(getComputedStyle(i2).backgroundColor, 'rgb(0, 0, 0)'); |
| 23 |
| 24 // Press mouse button |
| 25 eventSender.mouseDown(); |
| 26 assert_equals(document.activeElement.id, 'i1'); |
| 27 assert_equals(getComputedStyle(i1).backgroundColor, 'rgb(255, 0, 0)'); |
| 28 assert_equals(getComputedStyle(i2).backgroundColor, 'rgb(0, 0, 0)'); |
| 29 |
| 30 // Moving focus via TAB |
| 31 eventSender.keyDown('\t'); |
| 32 assert_equals(document.activeElement.id, 'i2'); |
| 33 assert_equals(getComputedStyle(i1).backgroundColor, 'rgb(255, 0, 0)'); |
| 34 assert_equals(getComputedStyle(i2).backgroundColor, 'rgb(0, 0, 0)'); |
| 35 |
| 36 // Release mouse button |
| 37 eventSender.mouseUp(); |
| 38 assert_equals(getComputedStyle(i1).backgroundColor, 'rgb(0, 0, 0)'); |
| 39 assert_equals(getComputedStyle(i2).backgroundColor, 'rgb(0, 0, 0)'); |
| 40 |
| 41 sandbox.remove(); |
| 42 }, ":active state should stick while mouse button is pressed regardless of f
ocus state."); |
| 43 } |
| 44 </script> |
| OLD | NEW |