summaryrefslogtreecommitdiffstats
path: root/devtools/client/inspector/rules/test/browser_rules_inactive_css_inline.js
blob: 2670e50d10031d8c38bd093fd298d12a51561e98 (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
/* Any copyright is dedicated to the Public Domain.
 http://creativecommons.org/publicdomain/zero/1.0/ */

"use strict";

// Test css properties that are inactive on block-level elements.

const TEST_URI = `
<style>
#block {
  border: 1px solid #000;
  vertical-align: sub;
}
td {
  vertical-align: super;
}
#flex {
  display: inline-flex;
  vertical-align: text-bottom;
}
</style>
<h1 style="vertical-align:text-bottom;">browser_rules_inactive_css_inline.js</h1>
<div id="block">Block</div>
<table>
  <tr><td>A table cell</td></tr>
</table>
<div id="flex">Inline flex element</div>
`;

const TEST_DATA = [
  {
    selector: "h1",
    inactiveDeclarations: [
      {
        declaration: { "vertical-align": "text-bottom" },
        ruleIndex: 0,
      },
    ],
  },
  {
    selector: "#block",
    inactiveDeclarations: [
      {
        declaration: { "vertical-align": "sub" },
        ruleIndex: 1,
      },
    ],
  },
  {
    selector: "td",
    activeDeclarations: [
      {
        declarations: { "vertical-align": "super" },
        ruleIndex: 1,
      },
    ],
  },
  {
    selector: "#flex",
    activeDeclarations: [
      {
        declarations: { "vertical-align": "text-bottom" },
        ruleIndex: 1,
      },
    ],
  },
];

add_task(async function () {
  await pushPref("devtools.inspector.inactive.css.enabled", true);
  await addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
  const { inspector, view } = await openRuleView();

  await runInactiveCSSTests(view, inspector, TEST_DATA);
});