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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/fast/selectors/focus-within-window-inactive.html
diff --git a/third_party/WebKit/LayoutTests/fast/selectors/focus-within-window-inactive.html b/third_party/WebKit/LayoutTests/fast/selectors/focus-within-window-inactive.html
new file mode 100644
index 0000000000000000000000000000000000000000..230da236824da53fb9f0a879efd4980b38cc0da1
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/selectors/focus-within-window-inactive.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<script src=../../resources/testharness.js></script>
+<script src=../../resources/testharnessreport.js></script>
+<style>
+ input {
+ background-color: rgb(50, 150, 200);
+ }
+ input:focus-within {
+ background-color: rgb(250, 200, 150);
+ }
+</style>
+<input id="input">
+<script>
+ test(() => assert_not_equals(window.testRunner, undefined),
+ "Check window.testRunner is available");
+
+ const input = document.getElementById("input");
+ input.focus();
+
+ test(() => assert_equals(getComputedStyle(input).backgroundColor, "rgb(250, 200, 150)"),
+ "Check ':focus-within' is applied after focusing the input");
+
+ testRunner.setWindowIsKey(false);
+ test(() => assert_equals(getComputedStyle(input).backgroundColor, "rgb(50, 150, 200)"),
+ "Check ':focus-within' is not applied when the window is inactive");
+
+ testRunner.setWindowIsKey(true);
+ test(() => assert_equals(getComputedStyle(input).backgroundColor, "rgb(250, 200, 150)"),
+ "Check ':focus-within' is applied when the window is active again");
+</script>

Powered by Google App Engine
This is Rietveld 408576698