commit c5116fb23794a207851827a4cbce60ca6b2c587e
parent 758b68648a78b45c4c1913d4f01867a3669e49f4
Author: Narcis Beleuzu <nbeleuzu@mozilla.com>
Date: Tue, 14 Oct 2025 19:46:02 +0300
Revert "Bug 1994181 - [devtools] Check for highlighted declarations in checkRuleViewContent. r=devtools-reviewers,jdescottes." for causing dt failures on browser_rules_variables-jump-to-definition.js
This reverts commit 8c0ac27a0237121e89f488151c162cf31172cfa2.
Diffstat:
2 files changed, 24 insertions(+), 63 deletions(-)
diff --git a/devtools/client/inspector/rules/test/browser_rules_search-filter_01.js b/devtools/client/inspector/rules/test/browser_rules_search-filter_01.js
@@ -48,10 +48,10 @@ 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 testAddTextInFilter(view);
+ await testAddTextInFilter(inspector, view);
});
-async function testAddTextInFilter(view) {
+async function testAddTextInFilter(inspector, view) {
for (const data of TEST_DATA) {
info(data.desc);
await setSearchFilter(view, data.search);
@@ -60,29 +60,26 @@ async function testAddTextInFilter(view) {
}
}
-async function checkRules(view) {
- info(
- "Check that the expected rules are visible and expected declarations are highlighted"
+function checkRules(view) {
+ info("Check that the correct rules are visible");
+ is(view.element.children.length, 2, "Should have 2 rules.");
+ is(
+ getRuleViewRuleEditor(view, 0).rule.selectorText,
+ "element",
+ "First rule is inline element."
+ );
+
+ const rule = getRuleViewRuleEditor(view, 1).rule;
+
+ is(rule.selectorText, "#testid, h1", "Second rule is #testid, h1.");
+ ok(
+ rule.textProps[0].editor.container.classList.contains("ruleview-highlight"),
+ "background-color text property is correctly highlighted."
);
- await checkRuleViewContent(view, [
- {
- selector: "element",
- declarations: [],
- },
- {
- selector: "#testid, h1",
- declarations: [
- {
- name: "background-color",
- value: "#00F !important",
- highlighted: true,
- },
- ],
- },
- ]);
}
async function clearSearchAndCheckRules(view) {
+ const doc = view.styleDocument;
const win = view.styleWindow;
const searchField = view.searchField;
const searchClearButton = view.searchClearButton;
@@ -93,33 +90,10 @@ async function clearSearchAndCheckRules(view) {
await onRuleviewFiltered;
info("Check the search filter is cleared and no rules are highlighted");
+ is(view.element.children.length, 3, "Should have 3 rules.");
ok(!searchField.value, "Search filter is cleared.");
-
- info("Check that all rules are displayed and no declaration is highlighted");
- await checkRuleViewContent(view, [
- {
- selector: "element",
- declarations: [],
- },
- {
- selector: "#testid, h1",
- declarations: [
- {
- name: "background-color",
- value: "#00F !important",
- highlighted: false,
- },
- ],
- },
- {
- selector: ".testclass",
- declarations: [
- {
- name: "width",
- value: "100%",
- highlighted: false,
- },
- ],
- },
- ]);
+ ok(
+ !doc.querySelectorAll(".ruleview-highlight").length,
+ "No rules are higlighted."
+ );
}
diff --git a/devtools/client/inspector/rules/test/head.js b/devtools/client/inspector/rules/test/head.js
@@ -1384,8 +1384,6 @@ function getSmallIncrementKey() {
* @param {Boolean|undefined} expectedElements[].declarations[].dirty - Is the declaration dirty,
* i.e. was it added/modified by the user (should have a left green border).
* Defaults to false
- * @param {Boolean|undefined} expectedElements[].declarations[].highlighted - Is the declaration
- * highlighted by a search.
* @param {String} expectedElements[].header - If we're expecting a header (Inherited from,
* Pseudo-elements, …), the text of said header.
*/
@@ -1443,7 +1441,7 @@ function checkRuleViewContent(view, expectedElements) {
is(
declarations.length,
expectedElement.declarations.length,
- `Got the expected number of declarations for expected element #${i} (${selector})`
+ "Got the expected number of declarations"
);
for (let j = 0; j < declarations.length; j++) {
const expectedDeclaration = expectedElement.declarations[j];
@@ -1458,12 +1456,6 @@ function checkRuleViewContent(view, expectedElements) {
expectedDeclaration?.name,
"Got expected property name"
);
- if (propName.innerText !== expectedDeclaration?.name) {
- // We don't have the expected property name, don't run the other assertions to
- // avoid spamming the output
- continue;
- }
-
is(
propValue.innerText,
expectedDeclaration?.value,
@@ -1486,11 +1478,6 @@ function checkRuleViewContent(view, expectedElements) {
!!expectedDeclaration?.dirty,
`"${selector}" ${propName.innerText} is ${expectedDeclaration?.dirty ? "dirty" : "not dirty"}`
);
- is(
- ruleViewPropertyElement.querySelector(".ruleview-highlight") !== null,
- !!expectedDeclaration?.highlighted,
- `"${selector}" ${propName.innerText} is ${expectedDeclaration?.highlighted ? "highlighted" : "not highlighted"} `
- );
}
}
}