Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(48)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/selectors/focus-within-window-inactive.html

Issue 2795143004: [selectors4] Implement :focus-within pseudo-class (Closed)
Patch Set: Rebased patch Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698