Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/fast/css/active-pseudo-and-focus-move.html |
| diff --git a/third_party/WebKit/LayoutTests/fast/css/active-pseudo-and-focus-move.html b/third_party/WebKit/LayoutTests/fast/css/active-pseudo-and-focus-move.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..036a8c3e28b57e369c942f29b64faeaeb59461b0 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/fast/css/active-pseudo-and-focus-move.html |
| @@ -0,0 +1,44 @@ |
| +<!DOCTYPE html> |
| +<script src='../../resources/testharness.js'></script> |
| +<script src='../../resources/testharnessreport.js'></script> |
| +<style> |
| +input { background-color: black; } |
| +input:active { background-color: red; } |
| +</style> |
| +<div id="sandbox"> |
| + <input id="i1" type="button"><input id="i2" type="button"> |
| +</div> |
| +<script> |
| +test(() => { |
| + if (window.eventSender) { |
| + var i1 = document.querySelector('#i1'); |
|
tkent
2016/03/25 08:33:13
indentation looks ugly.
kochi
2016/03/25 08:43:51
Oops, hard TAB sneaked in. Fixed.
(also swapped t
|
| + var x = i1.offsetLeft + i1.offsetWidth / 2; |
| + var y = i1.offsetTop + i1.offsetHeight / 2; |
| + eventSender.mouseMoveTo(x, y); |
| + |
| + var i2 = document.querySelector('#i2'); |
| + |
| + assert_equals(getComputedStyle(i1).backgroundColor, 'rgb(0, 0, 0)'); |
| + assert_equals(getComputedStyle(i2).backgroundColor, 'rgb(0, 0, 0)'); |
| + |
| + // Press mouse button |
| + eventSender.mouseDown(); |
| + assert_equals(document.activeElement.id, 'i1'); |
| + assert_equals(getComputedStyle(i1).backgroundColor, 'rgb(255, 0, 0)'); |
| + assert_equals(getComputedStyle(i2).backgroundColor, 'rgb(0, 0, 0)'); |
| + |
| + // Moving focus via TAB |
| + eventSender.keyDown('\t'); |
| + assert_equals(document.activeElement.id, 'i2'); |
| + assert_equals(getComputedStyle(i1).backgroundColor, 'rgb(255, 0, 0)'); |
| + assert_equals(getComputedStyle(i2).backgroundColor, 'rgb(0, 0, 0)'); |
| + |
| + // Release mouse button |
| + eventSender.mouseUp(); |
| + assert_equals(getComputedStyle(i1).backgroundColor, 'rgb(0, 0, 0)'); |
| + assert_equals(getComputedStyle(i2).backgroundColor, 'rgb(0, 0, 0)'); |
| + |
| + sandbox.remove(); |
| + } |
| +}, ":active state should stick while mouse button is pressed regardless of focus state."); |
| +</script> |