summaryrefslogtreecommitdiffstats
path: root/devtools/client/inspector/rules/test/browser_rules_css-compatibility-tooltip-telemetry.js
blob: 8f7a3b346fa030aa992b6538a3a81846b6d8366a (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
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
 http://creativecommons.org/publicdomain/zero/1.0/ */

"use strict";

// Test - Toggling rules linked to the element and the class
// Checking whether the compatibility warning icon is displayed
// correctly.
// If a rule is disabled, it is marked compatible to keep
// consistency with compatibility panel.
// We test both the compatible and incompatible rules here

const TEST_URI = `
<style>
  div {
    -moz-float-edge: content-box;
  }
</style>
<div></div>`;

const TEST_DATA = [
  {
    selector: "div",
    rules: [
      {},
      {
        "-moz-float-edge": {
          value: "content-box",
          expected: COMPATIBILITY_TOOLTIP_MESSAGE.deprecated,
        },
      },
    ],
  },
];

add_task(async function () {
  startTelemetry();

  await addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
  const { inspector, view } = await openRuleView();

  info("Check correctness of data by toggling tooltip open");
  await runCSSCompatibilityTests(view, inspector, TEST_DATA);

  checkResults();
});

function checkResults() {
  info(
    'Check the telemetry against "devtools.tooltip.shown" for label "css-compatibility" and ensure it is set'
  );
  checkTelemetry("devtools.tooltip.shown", "", 1, "css-compatibility");
}