summaryrefslogtreecommitdiffstats
path: root/devtools/client/styleeditor/test/browser_styleeditor_at_rules_sidebar.js
diff options
context:
space:
mode:
Diffstat (limited to 'devtools/client/styleeditor/test/browser_styleeditor_at_rules_sidebar.js')
-rw-r--r--devtools/client/styleeditor/test/browser_styleeditor_at_rules_sidebar.js30
1 files changed, 24 insertions, 6 deletions
diff --git a/devtools/client/styleeditor/test/browser_styleeditor_at_rules_sidebar.js b/devtools/client/styleeditor/test/browser_styleeditor_at_rules_sidebar.js
index a0a9bc93fd..d106d6780e 100644
--- a/devtools/client/styleeditor/test/browser_styleeditor_at_rules_sidebar.js
+++ b/devtools/client/styleeditor/test/browser_styleeditor_at_rules_sidebar.js
@@ -39,6 +39,8 @@ waitForExplicitFinish();
add_task(async function () {
await pushPref("layout.css.container-queries.enabled", true);
+ // Enable @property rules
+ await pushPref("layout.css.properties-and-values.enabled", true);
const { ui } = await openStyleEditorForURL(TESTCASE_URI);
@@ -88,7 +90,7 @@ async function testInlineMediaEditor(ui, editor) {
is(sidebar.hidden, false, "sidebar is showing on editor with @media");
const entries = sidebar.querySelectorAll(".at-rule-label");
- is(entries.length, 6, "6 @media rules displayed in sidebar");
+ is(entries.length, 7, "7 at-rules displayed in sidebar");
await testRule({
ui,
@@ -123,7 +125,6 @@ async function testInlineMediaEditor(ui, editor) {
ui,
editor,
rule: entries[3],
- conditionText: "",
line: 16,
type: "layer",
layerName: "myLayer",
@@ -146,6 +147,15 @@ async function testInlineMediaEditor(ui, editor) {
line: 21,
type: "support",
});
+
+ await testRule({
+ ui,
+ editor,
+ rule: entries[6],
+ line: 30,
+ type: "property",
+ propertyName: "--my-property",
+ });
}
async function testMediaEditor(ui, editor) {
@@ -273,27 +283,35 @@ async function testMediaRuleAdded(ui, editor) {
* @param {StyleEditorUI} options.ui
* @param {StyleSheetEditor} options.editor: The editor the rule is displayed in
* @param {Element} options.rule: The rule element in the media sidebar
- * @param {String} options.conditionText: media query condition text
+ * @param {String} options.conditionText: at-rule condition text (for @media, @container, @support)
* @param {Boolean} options.matches: Whether or not the document matches the rule
* @param {String} options.layerName: Optional name of the @layer
+ * @param {String} options.propertyName: Name of the @property if type is "property"
* @param {Number} options.line: Line of the rule
- * @param {String} options.type: The type of the rule (container, layer, media, support ).
+ * @param {String} options.type: The type of the rule (container, layer, media, support, property ).
* Defaults to "media".
*/
async function testRule({
ui,
editor,
rule,
- conditionText,
+ conditionText = "",
matches,
layerName,
+ propertyName,
line,
type = "media",
}) {
const atTypeEl = rule.querySelector(".at-rule-type");
+ let name;
+ if (type === "layer") {
+ name = layerName;
+ } else if (type === "property") {
+ name = propertyName;
+ }
is(
atTypeEl.textContent,
- `@${type}\u00A0${layerName ? `${layerName}\u00A0` : ""}`,
+ `@${type}\u00A0${name ? `${name}\u00A0` : ""}`,
"label for at-rule type is correct"
);