summaryrefslogtreecommitdiffstats
path: root/devtools/client/inspector/rules/test/browser_rules_mark_overridden_02.js
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--devtools/client/inspector/rules/test/browser_rules_mark_overridden_02.js48
1 files changed, 48 insertions, 0 deletions
diff --git a/devtools/client/inspector/rules/test/browser_rules_mark_overridden_02.js b/devtools/client/inspector/rules/test/browser_rules_mark_overridden_02.js
new file mode 100644
index 0000000000..283419def9
--- /dev/null
+++ b/devtools/client/inspector/rules/test/browser_rules_mark_overridden_02.js
@@ -0,0 +1,48 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+// Tests that the rule view marks overridden rules correctly for short hand
+// properties and the computed list properties
+
+const TEST_URI = `
+ <style type='text/css'>
+ #testid {
+ margin-left: 1px;
+ }
+ .testclass {
+ margin: 2px;
+ }
+ </style>
+ <div id='testid' class='testclass'>Styled Node</div>
+`;
+
+add_task(async function () {
+ await addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ const { inspector, view } = await openRuleView();
+ await selectNode("#testid", inspector);
+ await testMarkOverridden(inspector, view);
+});
+
+function testMarkOverridden(inspector, view) {
+ const elementStyle = view._elementStyle;
+
+ const classRule = elementStyle.rules[2];
+ const classProp = classRule.textProps[0];
+ ok(
+ !classProp.overridden,
+ "Class prop shouldn't be overridden, some props are still being used."
+ );
+
+ for (const computed of classProp.computed) {
+ if (computed.name.indexOf("margin-left") == 0) {
+ ok(computed.overridden, "margin-left props should be overridden.");
+ } else {
+ ok(
+ !computed.overridden,
+ "Non-margin-left props should not be overridden."
+ );
+ }
+ }
+}