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

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: 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"></iframe>
6 <script>
7 test(() => assert_not_equals(window.internals, undefined),
8 "Check window.internals is available");
9
10 const frame = document.getElementById("frame");
11 frame.contentDocument.open();
12 frame.contentDocument.write(`
13 <!DOCTYPE html>
14 <style>
15 input {
16 background-color: rgb(50, 150, 200);
17 }
18 input:focus-within {
19 background-color: rgb(250, 200, 150);
20 }
21 </style>
22 <input id="input" />
23 `);
24 frame.contentDocument.close();
rune 2017/04/28 13:00:03 You could probably just use the srcdoc attribute o
Manuel Rego 2017/05/02 07:53:35 Done.
25
26 const input = frame.contentDocument.getElementById("input");
27 input.focus();
28
29 test(() => assert_equals(frame.contentWindow.getComputedStyle(input).backgroun dColor, "rgb(250, 200, 150)"),
30 "Check ':focus-within' is applied after focusing the input");
31
32 frame.contentWindow.internals.setFocused(false);
33 test(() => assert_equals(frame.contentWindow.getComputedStyle(input).backgroun dColor, "rgb(50, 150, 200)"),
34 "Check ':focus-within' is not applied when the frame is unfocused");
35
36 frame.contentWindow.internals.setFocused(true);
37 test(() => assert_equals(frame.contentWindow.getComputedStyle(input).backgroun dColor, "rgb(250, 200, 150)"),
38 "Check ':focus-within' is applied when the frame is focsued again");
39 </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