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

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

Issue 2847803007: [selectors4] :focus-within test when iframe loses focus (Closed)
Patch Set: Use "srcdoc" Created 3 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <iframe id="frame" srcdoc="
6 <!DOCTYPE html>
7 <style>
8 input {
9 background-color: rgb(50, 150, 200);
10 }
11 input:focus-within {
12 background-color: rgb(250, 200, 150);
13 }
14 </style>
15 <input id='input' />
16 "></iframe>
17 <script>
18 test(() => assert_not_equals(window.internals, undefined),
19 "Check window.internals is available");
20
21 const frame = document.getElementById("frame");
22 frame.addEventListener("load", () => {
23 const input = frame.contentDocument.getElementById("input");
24 input.focus();
25
26 test(() => assert_equals(frame.contentWindow.getComputedStyle(input).backgro undColor, "rgb(250, 200, 150)"),
27 "Check ':focus-within' is applied after focusing the input");
28
29 frame.contentWindow.internals.setFocused(false);
30 test(() => assert_equals(frame.contentWindow.getComputedStyle(input).backgro undColor, "rgb(50, 150, 200)"),
31 "Check ':focus-within' is not applied when the frame is unfocused");
32
33 frame.contentWindow.internals.setFocused(true);
34 test(() => assert_equals(frame.contentWindow.getComputedStyle(input).backgro undColor, "rgb(250, 200, 150)"),
35 "Check ':focus-within' is applied when the frame is focsued again");
36 });
37 </script>
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698