summaryrefslogtreecommitdiffstats
path: root/devtools/client/inspector/rules/test/browser_rules_edit-property-remove_04.js
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--devtools/client/inspector/rules/test/browser_rules_edit-property-remove_04.js45
1 files changed, 45 insertions, 0 deletions
diff --git a/devtools/client/inspector/rules/test/browser_rules_edit-property-remove_04.js b/devtools/client/inspector/rules/test/browser_rules_edit-property-remove_04.js
new file mode 100644
index 0000000000..0d9915285c
--- /dev/null
+++ b/devtools/client/inspector/rules/test/browser_rules_edit-property-remove_04.js
@@ -0,0 +1,45 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+// Tests that removing the only declaration from a rule and unselecting then re-selecting
+// the element will not restore the removed declaration. Bug 1512956
+
+const TEST_URI = `
+ <style type='text/css'>
+ #testid {
+ color: #00F;
+ }
+ </style>
+ <div id='testid'>Styled Node</div>
+ <div id='empty'></div>
+`;
+
+add_task(async function () {
+ await addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ const { inspector, view } = await openRuleView();
+
+ info("Select original node");
+ await selectNode("#testid", inspector);
+
+ info("Get the first property in the #testid rule");
+ const rule = getRuleViewRuleEditor(view, 1).rule;
+ const prop = rule.textProps[0];
+
+ info("Delete the property name to remove the declaration");
+ const onRuleViewChanged = view.once("ruleview-changed");
+ await removeProperty(view, prop, false);
+ info("Wait for Rule view to update");
+ await onRuleViewChanged;
+
+ is(rule.textProps.length, 0, "No CSS properties left on the rule");
+
+ info("Select another node");
+ await selectNode("#empty", inspector);
+
+ info("Select original node again");
+ await selectNode("#testid", inspector);
+
+ is(rule.textProps.length, 0, "Still no CSS properties on the rule");
+});