summaryrefslogtreecommitdiffstats
path: root/devtools/client/commandline/test/browser_cmd_csscoverage_page1.html
blob: b137ac1e790969e7edc1dc51a5897a63e38bd134 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<!DOCTYPE HTML>
<html>
<head>
  <meta charset="utf-8">
  <!--
  First page of the css coverage test.
  * Contains page2 in an iframe
  * Forwards to page2 on a timeout
  -->
  <title>Page 1</title>
  <style>
    @import url(browser_cmd_csscoverage_sheetD.css);
    /* This should match below */
    .page1-test1 {
      color: #011;
    }
    /* This should not match below */
    .page1-test2 {
      color: #012;
    }
    /* This would match if the mouse was in the right place */
    .page1-test3:hover {
      color: #013;
    }
    /* This can't match because it's illegal */
    .page1-test4:broken {
      color: #014;
    }
    /* This doesn't match until the event fires */
    .page1-test5 {
      color: #015;
    }
    /* TODO: include examples of all CSS rules in
    https://developer.mozilla.org/en-US/docs/Web/API/CSSRule
    and include tests for rules nested in media rules, etc */

    /* We're not testing unparable CSS right now */
  </style>
  <link rel="stylesheet" type="text/css" href="browser_cmd_csscoverage_sheetA.css">
  <link rel="stylesheet" type="text/css" href="browser_cmd_csscoverage_sheetB.css">
  <script type="application/javascript;version=1.8">
  /* How quickly do we rush through this? */
  let delay = 500;
  window.addEventListener("load", () => {
    dump('TEST-INFO | load from browser_cmd_csscoverage_page1.html\n');
    setTimeout(() => {
      dump('TEST-INFO | timeout from browser_cmd_csscoverage_page1.html\n');
      /* This adds <div class=page1-test5></div> */
      let parent = document.querySelector("#page1-test5-holder");
      let child = document.createElement("div");
      child.classList.add("page1-test5");
      parent.appendChild(child);

      /* Then navigate to the next step */
      window.location.href = "browser_cmd_csscoverage_page3.html"
    }, delay);
  });
  </script>
</head>
<body>

<h2>Page 1</h2>

<div class=page1-test1>.page1-test1</div>
<div class=page1-test3>.page1-test3</div>

<div id=page1-test5-holder></div>

<div class=sheetA-test1>.sheetA-test1</div>
<div class=sheetA-test3>.sheetA-test3</div>
<div class=sheetB-test1>.sheetB-test1</div>
<div class=sheetB-test3>.sheetB-test3</div>
<div class=sheetC-test1>.sheetC-test1</div>
<div class=sheetC-test3>.sheetC-test3</div>
<div class=sheetD-test1>.sheetD-test1</div>
<div class=sheetD-test3>.sheetD-test3</div>

<iframe src=browser_cmd_csscoverage_page2.html></iframe>

<p>
  <a href="browser_cmd_csscoverage_page3.html">Page 3</a>
</p>

</body>
</html>