Bug 1415940 Part 8: Add a browser test to confirm DOM added rules work with leading newlines. draft
authorBrad Werth <bwerth@mozilla.com>
Thu, 04 Jan 2018 14:44:39 -0800
changeset 722745 c50143f56de464f373f6e122e476949a1a5630d4
parent 722744 95620b5d83815ebb160a6138b77779a6867c5a7a
child 722791 e1bf9d42fce8a0c8df8ce87aaac8105c2fb4986f
push id96224
push userbwerth@mozilla.com
push dateFri, 19 Jan 2018 19:24:40 +0000
bugs1415940
milestone59.0a1
Bug 1415940 Part 8: Add a browser test to confirm DOM added rules work with leading newlines. MozReview-Commit-ID: Alj2VimZNxQ
devtools/client/inspector/rules/test/browser_rules_cssom.js
devtools/client/inspector/rules/test/doc_cssom.html
--- a/devtools/client/inspector/rules/test/browser_rules_cssom.js
+++ b/devtools/client/inspector/rules/test/browser_rules_cssom.js
@@ -10,13 +10,20 @@
 const TEST_URI = URL_ROOT + "doc_cssom.html";
 
 add_task(function* () {
   yield addTab(TEST_URI);
   let {inspector, view} = yield openRuleView();
   yield selectNode("#target", inspector);
 
   let elementStyle = view._elementStyle;
-  let rule = elementStyle.rules[1];
+  let rule;
 
-  is(rule.textProps.length, 1, "rule should have one property");
+  rule = elementStyle.rules[1];
+  is(rule.textProps.length, 1, "rule 1 should have one property");
   is(rule.textProps[0].name, "color", "the property should be 'color'");
+  is(rule.ruleLine, -1, "the property has no source line");
+
+  rule = elementStyle.rules[2];
+  is(rule.textProps.length, 1, "rule 2 should have one property");
+  is(rule.textProps[0].name, "font-weight", "the property should be 'font-weight'");
+  is(rule.ruleLine, -1, "the property has no source line");
 });
--- a/devtools/client/inspector/rules/test/doc_cssom.html
+++ b/devtools/client/inspector/rules/test/doc_cssom.html
@@ -6,17 +6,17 @@
 
   <script>
     "use strict";
     window.onload = function () {
       let x = document.styleSheets[0];
       x.insertRule("div { color: seagreen; }", 1);
 
       // Add a rule with a leading newline, to test that inspector can handle it.
-      x.insertRule("\n\ndiv { font-weight: bold; }", 1);
+      x.insertRule("\ndiv { font-weight: bold; }", 1);
     };
   </script>
 
   <style>
     span { }
   </style>
 </head>
 <body>