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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
/* 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 - Add and rename rules
// Test the correctness of the compatibility
// status when the incompatible rules are added
// or renamed to another universally compatible
// rule
const TEST_URI = `
<style>
body {
user-select: none;
text-decoration-skip: none;
clip: auto;
}
</style>
<body>
</body>`;
const TEST_DATA_INITIAL = [
{
selector: "body",
rules: [
{},
{
"user-select": {
value: "none",
expected: COMPATIBILITY_TOOLTIP_MESSAGE.default,
},
"text-decoration-skip": {
value: "none",
expected: COMPATIBILITY_TOOLTIP_MESSAGE.experimental,
},
clip: {
value: "auto",
expected: COMPATIBILITY_TOOLTIP_MESSAGE["deprecated-supported"],
},
},
],
},
];
const TEST_DATA_ADD_RULE = [
{
selector: "body",
rules: [
{
"-moz-float-edge": {
value: "content-box",
expected: COMPATIBILITY_TOOLTIP_MESSAGE.deprecated,
},
},
{
"user-select": {
value: "none",
expected: COMPATIBILITY_TOOLTIP_MESSAGE.default,
},
"text-decoration-skip": {
value: "none",
expected: COMPATIBILITY_TOOLTIP_MESSAGE.experimental,
},
clip: {
value: "auto",
expected: COMPATIBILITY_TOOLTIP_MESSAGE["deprecated-supported"],
},
},
],
},
];
const TEST_DATA_RENAME_RULE = [
{
selector: "body",
rules: [
{
"-moz-float-edge": {
value: "content-box",
expected: COMPATIBILITY_TOOLTIP_MESSAGE.deprecated,
},
},
{
"background-color": {
value: "green",
},
"text-decoration-skip": {
value: "none",
expected: COMPATIBILITY_TOOLTIP_MESSAGE.experimental,
},
clip: {
value: "auto",
expected: COMPATIBILITY_TOOLTIP_MESSAGE["deprecated-supported"],
},
},
],
},
];
add_task(async function () {
await addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
const { inspector, view } = await openRuleView();
const userSelect = { "user-select": "none" };
const backgroundColor = { "background-color": "green" };
info("Check initial compatibility issues");
await runCSSCompatibilityTests(view, inspector, TEST_DATA_INITIAL);
info(
"Add an inheritable incompatible rule and check the compatibility status"
);
await addProperty(view, 0, "-moz-float-edge", "content-box");
await runCSSCompatibilityTests(view, inspector, TEST_DATA_ADD_RULE);
info("Rename user-select to color and check the compatibility status");
await updateDeclaration(view, 1, userSelect, backgroundColor);
await runCSSCompatibilityTests(view, inspector, TEST_DATA_RENAME_RULE);
});
|