Debian Codegraph @

plugins/postcss-focus-within/test/_browser.html

raw
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta charset="utf-8">
5 <title></title>
6 <link rel="help" href="https://www.w3.org/TR/selectors-4/#the-focus-within-pseudo">
7 <link rel="stylesheet" href="/test/browser.expect.css">
8 <script src="/dist/browser-global.js"></script>
9 <script>self._focusWithinInit = focusWithinInit</script>
10 <script>self._focusWithinInit()</script>
11 </head>
12 <body>
13 <div id="a-grand-parent">
14 <input type="text" id="a-grand-parent-input">
15
16 <div id="a-parent">
17 <input type="text" id="a-parent-input">
18
19 <div id="a-child">
20 <input type="text" id="a-child-input">
21 </div>
22 </div>
23 </div>
24
25 <script type="module">
26 const purple = 'rgb(128, 0, 128)';
27 const green = 'rgb(0, 128, 0)';
28
29 self.checkElement = async function checkElement(testName, element, shouldBeStyled) {
30 const el = document.getElementById(element);
31 const bg = getComputedStyle(el).backgroundColor;
32 const matchingColor = el.tagName === 'INPUT' ? green : purple;
33
34 if (shouldBeStyled && bg !== matchingColor) {
35 throw new Error(`${testName}: ${element} should be styled`);
36 } else if (!shouldBeStyled && bg === matchingColor) {
37 throw new Error(`${testName}: ${element} should not be styled`);
38 }
39
40 return true;
41 };
42 </script>
43 </body>
44 </html>