blob: 24a0dfbcfcb8df06181263d7ef83bf614f8eb58e (
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
|
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Test the class panel shows a message when invalid nodes are selected.
// text nodes, pseudo-elements, DOCTYPE, comment nodes.
add_task(async function () {
await addTab(`data:text/html;charset=utf-8,
<body>
<style>div::after {content: "test";}</style>
<!-- comment -->
Some text
<div></div>
</body>`);
info("Open the class panel");
const { inspector, view } = await openRuleView();
view.showClassPanel();
info("Selecting the DOCTYPE node");
const { nodes } = await inspector.walker.children(inspector.walker.rootNode);
await selectNode(nodes[0], inspector);
checkMessageIsDisplayed(view);
info("Selecting the comment node");
const styleNode = await getNodeFront("style", inspector);
const commentNode = await inspector.walker.nextSibling(styleNode);
await selectNode(commentNode, inspector);
checkMessageIsDisplayed(view);
info("Selecting the text node");
const textNode = await inspector.walker.nextSibling(commentNode);
await selectNode(textNode, inspector);
checkMessageIsDisplayed(view);
info("Selecting the ::after pseudo-element");
const divNode = await getNodeFront("div", inspector);
const pseudoElement = (await inspector.walker.children(divNode)).nodes[0];
await selectNode(pseudoElement, inspector);
checkMessageIsDisplayed(view);
});
function checkMessageIsDisplayed(view) {
ok(
view.classListPreviewer.classesEl.querySelector(".no-classes"),
"The message is displayed"
);
checkClassPanelContent(view, []);
}
|