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
|
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Test that classes can be toggled in the class panel
add_task(async function () {
await addTab("data:text/html;charset=utf-8,<body class='class1 class2'>");
const { view } = await openRuleView();
info("Open the class panel");
view.showClassPanel();
info(
"Click on class1 and check that the checkbox is unchecked and the DOM is updated"
);
await toggleClassPanelCheckBox(view, "class1");
checkClassPanelContent(view, [
{ name: "class1", state: false },
{ name: "class2", state: true },
]);
let newClassName = await getContentPageElementAttribute("body", "class");
is(newClassName, "class2", "The class attribute has been updated in the DOM");
info("Click on class2 and check the same thing");
await toggleClassPanelCheckBox(view, "class2");
checkClassPanelContent(view, [
{ name: "class1", state: false },
{ name: "class2", state: false },
]);
newClassName = await getContentPageElementAttribute("body", "class");
is(newClassName, "", "The class attribute has been updated in the DOM");
info("Click on class2 and checks that the class is added again");
await toggleClassPanelCheckBox(view, "class2");
checkClassPanelContent(view, [
{ name: "class1", state: false },
{ name: "class2", state: true },
]);
newClassName = await getContentPageElementAttribute("body", "class");
is(newClassName, "class2", "The class attribute has been updated in the DOM");
info("And finally, click on class1 again and checks it is added again");
await toggleClassPanelCheckBox(view, "class1");
checkClassPanelContent(view, [
{ name: "class1", state: true },
{ name: "class2", state: true },
]);
newClassName = await getContentPageElementAttribute("body", "class");
is(
newClassName,
"class1 class2",
"The class attribute has been updated in the DOM"
);
});
|