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
|
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Test toggling the shapes highlighter in the rule view with clip-path and shape-outside
// on the same element.
const TEST_URI = `
<style type='text/css'>
.shape {
width: 800px;
height: 800px;
clip-path: circle(25%);
shape-outside: circle(25%);
}
</style>
<div class="shape" id="shape1"></div>
<div class="shape" id="shape2"></div>
`;
add_task(async function () {
await addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
const { inspector, view } = await openRuleView();
const highlighters = view.highlighters;
info("Selecting the first shapes container.");
await selectNode("#shape1", inspector);
let clipPathContainer = getRuleViewProperty(
view,
".shape",
"clip-path"
).valueSpan;
let clipPathShapeToggle = clipPathContainer.querySelector(
".ruleview-shapeswatch"
);
let shapeOutsideContainer = getRuleViewProperty(
view,
".shape",
"shape-outside"
).valueSpan;
let shapeOutsideToggle = shapeOutsideContainer.querySelector(
".ruleview-shapeswatch"
);
info(
"Toggling ON the CSS shapes highlighter for clip-path from the rule-view."
);
let onHighlighterShown = highlighters.once("shapes-highlighter-shown");
clipPathShapeToggle.click();
await onHighlighterShown;
ok(highlighters.shapesHighlighterShown, "CSS shapes highlighter is shown.");
ok(
clipPathShapeToggle.classList.contains("active"),
"clip-path toggle button is active."
);
ok(
!shapeOutsideToggle.classList.contains("active"),
"shape-outside toggle button is not active."
);
info(
"Toggling ON the CSS shapes highlighter for shape-outside from the rule-view."
);
onHighlighterShown = highlighters.once("shapes-highlighter-shown");
shapeOutsideToggle.click();
await onHighlighterShown;
ok(highlighters.shapesHighlighterShown, "CSS shapes highlighter is shown.");
ok(
!clipPathShapeToggle.classList.contains("active"),
"clip-path toggle button is not active."
);
ok(
shapeOutsideToggle.classList.contains("active"),
"shape-outside toggle button is active."
);
info("Selecting the second shapes container.");
await selectNode("#shape2", inspector);
clipPathContainer = getRuleViewProperty(
view,
".shape",
"clip-path"
).valueSpan;
clipPathShapeToggle = clipPathContainer.querySelector(
".ruleview-shapeswatch"
);
shapeOutsideContainer = getRuleViewProperty(
view,
".shape",
"shape-outside"
).valueSpan;
shapeOutsideToggle = shapeOutsideContainer.querySelector(
".ruleview-shapeswatch"
);
ok(
!clipPathShapeToggle.classList.contains("active"),
"clip-path toggle button is not active."
);
ok(
!shapeOutsideToggle.classList.contains("active"),
"shape-outside toggle button is not active."
);
});
|