OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <meta charset="utf-8"> |
| 3 <script src=../../resources/testharness.js></script> |
| 4 <script src=../../resources/testharnessreport.js></script> |
| 5 <style> |
| 6 input { |
| 7 background-color: rgb(50, 150, 200); |
| 8 } |
| 9 input:focus-within { |
| 10 background-color: rgb(250, 200, 150); |
| 11 } |
| 12 </style> |
| 13 <input id="input"> |
| 14 <script> |
| 15 test(() => assert_not_equals(window.testRunner, undefined), |
| 16 "Check window.testRunner is available"); |
| 17 |
| 18 const input = document.getElementById("input"); |
| 19 input.focus(); |
| 20 |
| 21 test(() => assert_equals(getComputedStyle(input).backgroundColor, "rgb(250, 20
0, 150)"), |
| 22 "Check ':focus-within' is applied after focusing the input"); |
| 23 |
| 24 testRunner.setWindowIsKey(false); |
| 25 test(() => assert_equals(getComputedStyle(input).backgroundColor, "rgb(50, 150
, 200)"), |
| 26 "Check ':focus-within' is not applied when the window is inactive"); |
| 27 |
| 28 testRunner.setWindowIsKey(true); |
| 29 test(() => assert_equals(getComputedStyle(input).backgroundColor, "rgb(250, 20
0, 150)"), |
| 30 "Check ':focus-within' is applied when the window is active again"); |
| 31 </script> |
OLD | NEW |