summaryrefslogtreecommitdiffstats
path: root/devtools/client/inspector/compatibility/test/browser/browser_compatibility_event_selected-node-change.js
blob: d24f450968ef208ea63d0d43676845dfddcde828 (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
86
/* Any copyright is dedicated to the Public Domain.
   http://creativecommons.org/publicdomain/zero/1.0/ */

"use strict";

// Test whether the content of the issue list will be changed when the new node is selected.

const TEST_URI = `
  <style>
  body {
    ruby-align: center;
  }

  .has-issue {
    scrollbar-width: thin;
    user-modify: read-only;
  }

  .no-issue {
    color: black;
  }
  </style>
  <body>
    <div class="has-issue">has issue</div>
    <div class="no-issue">no issue</div>
  </body>
`;

const TEST_DATA_SELECTED = [
  {
    selector: ".has-issue",
    expectedIssues: [
      {
        property: "scrollbar-width",
        url: "https://developer.mozilla.org/docs/Web/CSS/scrollbar-width",
      },
      {
        property: "user-modify",
        url: "https://developer.mozilla.org/docs/Web/CSS/user-modify",
      },
    ],
  },
  {
    selector: ".no-issue",
    expectedIssues: [],
  },
  {
    selector: "body",
    expectedIssues: [
      {
        property: "ruby-align",
        url: "https://developer.mozilla.org/docs/Web/CSS/ruby-align",
      },
    ],
  },
];

const TEST_DATA_ALL = [
  {
    property: "ruby-align",
    url: "https://developer.mozilla.org/docs/Web/CSS/ruby-align",
  },
  {
    property: "scrollbar-width",
    url: "https://developer.mozilla.org/docs/Web/CSS/scrollbar-width",
  },
  {
    property: "user-modify",
    url: "https://developer.mozilla.org/docs/Web/CSS/user-modify",
  },
];

add_task(async function () {
  await addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));

  const { allElementsPane, inspector, selectedElementPane } =
    await openCompatibilityView();

  for (const { selector, expectedIssues } of TEST_DATA_SELECTED) {
    info(`Check the issue list for ${selector} node`);
    await selectNode(selector, inspector);
    await assertIssueList(selectedElementPane, expectedIssues);
    info("Check whether the issues on all elements pane are not changed");
    await assertIssueList(allElementsPane, TEST_DATA_ALL);
  }
});