Styled Node
`;
add_task(function*() {
yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
let {inspector, view} = yield openRuleView();
- yield selectNode("#testid", inspector);
+ yield selectNode(".testclass", inspector);
yield testAddTextInFilter(inspector, view);
});
-function* testAddTextInFilter(inspector, ruleView) {
- info("Setting filter text to \"" + SEARCH + "\"");
-
- let win = ruleView.styleWindow;
- let searchField = ruleView.searchField;
- let onRuleViewFiltered = inspector.once("ruleview-filtered");
-
- searchField.focus();
- synthesizeKeys(SEARCH, win);
- yield onRuleViewFiltered;
+function* testAddTextInFilter(inspector, view) {
+ yield setSearchFilter(view, SEARCH);
info("Check that the correct rules are visible");
- is(ruleView.element.children.length, 2, "Should have 2 rules.");
- is(getRuleViewRuleEditor(ruleView, 0).rule.selectorText, "element",
+ is(view.element.children.length, 2, "Should have 2 rules.");
+ is(getRuleViewRuleEditor(view, 0).rule.selectorText, "element",
"First rule is inline element.");
- let rule = getRuleViewRuleEditor(ruleView, 1).rule;
+ let rule = getRuleViewRuleEditor(view, 1).rule;
let ruleEditor = rule.textProps[0].editor;
let computed = ruleEditor.computed;
- is(rule.selectorText, "#testid", "Second rule is #testid.");
+ is(rule.selectorText, ".testclass", "Second rule is .testclass.");
ok(ruleEditor.expander.getAttribute("open"), "Expander is open.");
ok(!ruleEditor.container.classList.contains("ruleview-highlight"),
- "margin text property is not highlighted.");
- ok(computed.hasAttribute("filter-open"), "margin computed list is open.");
-
+ "background property is not highlighted.");
+ ok(computed.hasAttribute("filter-open"), "background computed list is open.");
ok(computed.children[0].classList.contains("ruleview-highlight"),
- "margin-top computed property is not highlighted.");
- ok(!computed.children[1].classList.contains("ruleview-highlight"),
- "margin-right computed property is not highlighted.");
- ok(!computed.children[2].classList.contains("ruleview-highlight"),
- "margin-bottom computed property is not highlighted.");
- ok(!computed.children[3].classList.contains("ruleview-highlight"),
- "margin-left computed property is not highlighted.");
+ "background-color computed property is highlighted.");
}
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_search-filter-computed-list_04.js b/browser/devtools/styleinspector/test/browser_ruleview_search-filter-computed-list_04.js
index 58873f15599..5631e747ca0 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_search-filter-computed-list_04.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_search-filter-computed-list_04.js
@@ -5,61 +5,59 @@
"use strict";
// Tests that the rule view search filter works properly in the computed list
-// for parsed property value.
+// for newly modified property values.
-const SEARCH = ":4px";
+const SEARCH = "0px";
const TEST_URI = `
-
-
`;
add_task(function*() {
yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
let {inspector, view} = yield openRuleView();
yield selectNode("#testid", inspector);
- yield testAddTextInFilter(inspector, view);
+ yield testModifyPropertyValueFilter(inspector, view);
});
-function* testAddTextInFilter(inspector, ruleView) {
- info("Setting filter text to \"" + SEARCH + "\"");
+function* testModifyPropertyValueFilter(inspector, view) {
+ yield setSearchFilter(view, SEARCH);
- let win = ruleView.styleWindow;
- let searchField = ruleView.searchField;
- let onRuleViewFiltered = inspector.once("ruleview-filtered");
-
- searchField.focus();
- synthesizeKeys(SEARCH, win);
- yield onRuleViewFiltered;
+ let rule = getRuleViewRuleEditor(view, 1).rule;
+ let propEditor = rule.textProps[0].editor;
+ let computed = propEditor.computed;
+ let editor = yield focusEditableField(view, propEditor.valueSpan);
info("Check that the correct rules are visible");
- is(ruleView.element.children.length, 2, "Should have 2 rules.");
- is(getRuleViewRuleEditor(ruleView, 0).rule.selectorText, "element",
- "First rule is inline element.");
-
- let rule = getRuleViewRuleEditor(ruleView, 1).rule;
- let ruleEditor = rule.textProps[0].editor;
- let computed = ruleEditor.computed;
-
is(rule.selectorText, "#testid", "Second rule is #testid.");
- ok(!ruleEditor.expander.getAttribute("open"), "Expander is closed.");
- ok(ruleEditor.container.classList.contains("ruleview-highlight"),
+ ok(!propEditor.container.classList.contains("ruleview-highlight"),
+ "margin text property is not highlighted.");
+ ok(rule.textProps[1].editor.container.classList
+ .contains("ruleview-highlight"),
+ "top text property is correctly highlighted.");
+
+ let onBlur = once(editor.input, "blur");
+ let onModification = rule._applyingModifications;
+ EventUtils.sendString("4px 0px", view.styleWindow);
+ EventUtils.synthesizeKey("VK_RETURN", {});
+ yield onBlur;
+ yield onModification;
+
+ ok(propEditor.container.classList.contains("ruleview-highlight"),
"margin text property is correctly highlighted.");
ok(!computed.hasAttribute("filter-open"), "margin computed list is closed.");
-
- ok(computed.children[0].classList.contains("ruleview-highlight"),
- "margin-top computed property is correctly highlighted.");
- ok(!computed.children[1].classList.contains("ruleview-highlight"),
- "margin-right computed property is not highlighted.");
- ok(computed.children[2].classList.contains("ruleview-highlight"),
- "margin-bottom computed property is correctly highlighted.");
- ok(!computed.children[3].classList.contains("ruleview-highlight"),
- "margin-left computed property is not highlighted.");
+ ok(!computed.children[0].classList.contains("ruleview-highlight"),
+ "margin-top computed property is not highlighted.");
+ ok(computed.children[1].classList.contains("ruleview-highlight"),
+ "margin-right computed property is correctly highlighted.");
+ ok(!computed.children[2].classList.contains("ruleview-highlight"),
+ "margin-bottom computed property is not highlighted.");
+ ok(computed.children[3].classList.contains("ruleview-highlight"),
+ "margin-left computed property is correctly highlighted.");
}
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_search-filter-computed-list_05.js b/browser/devtools/styleinspector/test/browser_ruleview_search-filter-computed-list_05.js
deleted file mode 100644
index a8b87d3bb9d..00000000000
--- a/browser/devtools/styleinspector/test/browser_ruleview_search-filter-computed-list_05.js
+++ /dev/null
@@ -1,65 +0,0 @@
-/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-// Tests that the rule view search filter works properly in the computed list
-// for parsed property name.
-
-const SEARCH = "margin-top:";
-
-const TEST_URI = `
-
-
-`;
-
-add_task(function*() {
- yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
- let {inspector, view} = yield openRuleView();
- yield selectNode("#testid", inspector);
- yield testAddTextInFilter(inspector, view);
-});
-
-function* testAddTextInFilter(inspector, ruleView) {
- info("Setting filter text to \"" + SEARCH + "\"");
-
- let win = ruleView.styleWindow;
- let searchField = ruleView.searchField;
- let onRuleViewFiltered = inspector.once("ruleview-filtered");
-
- searchField.focus();
- synthesizeKeys(SEARCH, win);
- yield onRuleViewFiltered;
-
- info("Check that the correct rules are visible");
- is(ruleView.element.children.length, 2, "Should have 2 rules.");
- is(getRuleViewRuleEditor(ruleView, 0).rule.selectorText, "element",
- "First rule is inline element.");
-
- let rule = getRuleViewRuleEditor(ruleView, 1).rule;
- let ruleEditor = rule.textProps[0].editor;
- let computed = ruleEditor.computed;
-
- is(rule.selectorText, "#testid", "Second rule is #testid.");
- ok(ruleEditor.expander.getAttribute("open"), "Expander is open.");
- ok(!ruleEditor.container.classList.contains("ruleview-highlight"),
- "margin text property is not highlighted.");
- ok(computed.hasAttribute("filter-open"), "margin computed list is open.");
-
- ok(computed.children[0].classList.contains("ruleview-highlight"),
- "margin-top computed property is correctly highlighted.");
- ok(!computed.children[1].classList.contains("ruleview-highlight"),
- "margin-right computed property is not highlighted.");
- ok(!computed.children[2].classList.contains("ruleview-highlight"),
- "margin-bottom computed property is not highlighted.");
- ok(!computed.children[3].classList.contains("ruleview-highlight"),
- "margin-left computed property is not highlighted.");
-}
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_search-filter-computed-list_06.js b/browser/devtools/styleinspector/test/browser_ruleview_search-filter-computed-list_06.js
deleted file mode 100644
index dc2fa98b84f..00000000000
--- a/browser/devtools/styleinspector/test/browser_ruleview_search-filter-computed-list_06.js
+++ /dev/null
@@ -1,101 +0,0 @@
-/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-// Tests that the rule view search filter works properly in the computed list
-// when modifying the existing search filter value
-
-const SEARCH = "margin-";
-
-const TEST_URI = `
-
-
-`;
-
-add_task(function*() {
- yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
- let {inspector, view} = yield openRuleView();
- yield selectNode("#testid", inspector);
- yield testAddTextInFilter(inspector, view);
- yield testRemoveTextInFilter(inspector, view);
-});
-
-function* testAddTextInFilter(inspector, ruleView) {
- info("Setting filter text to \"" + SEARCH + "\"");
-
- let win = ruleView.styleWindow;
- let searchField = ruleView.searchField;
- let onRuleViewFiltered = inspector.once("ruleview-filtered");
-
- searchField.focus();
- synthesizeKeys(SEARCH, win);
- yield onRuleViewFiltered;
-
- info("Check that the correct rules are visible");
- is(ruleView.element.children.length, 2, "Should have 2 rules.");
- is(getRuleViewRuleEditor(ruleView, 0).rule.selectorText, "element",
- "First rule is inline element.");
-
- let rule = getRuleViewRuleEditor(ruleView, 1).rule;
- let ruleEditor = rule.textProps[0].editor;
- let computed = ruleEditor.computed;
-
- is(rule.selectorText, "#testid", "Second rule is #testid.");
- ok(ruleEditor.expander.getAttribute("open"), "Expander is open.");
- ok(!ruleEditor.container.classList.contains("ruleview-highlight"),
- "margin text property is not highlighted.");
- ok(computed.hasAttribute("filter-open"), "margin computed list is open.");
-
- ok(computed.children[0].classList.contains("ruleview-highlight"),
- "margin-top computed property is correctly highlighted.");
- ok(computed.children[1].classList.contains("ruleview-highlight"),
- "margin-right computed property is correctly highlighted.");
- ok(computed.children[2].classList.contains("ruleview-highlight"),
- "margin-bottom computed property is correctly highlighted.");
- ok(computed.children[3].classList.contains("ruleview-highlight"),
- "margin-left computed property is correctly highlighted.");
-}
-
-function* testRemoveTextInFilter(inspector, ruleView) {
- info("Press backspace and set filter text to \"margin\"");
-
- let win = ruleView.styleWindow;
- let searchField = ruleView.searchField;
-
- searchField.focus();
- EventUtils.synthesizeKey("VK_BACK_SPACE", {}, win);
- yield inspector.once("ruleview-filtered");
-
- info("Check that the correct rules are visible");
- is(ruleView.element.children.length, 2, "Should have 2 rules.");
- is(getRuleViewRuleEditor(ruleView, 0).rule.selectorText, "element",
- "First rule is inline element.");
-
- let rule = getRuleViewRuleEditor(ruleView, 1).rule;
- let ruleEditor = rule.textProps[0].editor;
- let computed = ruleEditor.computed;
-
- is(rule.selectorText, "#testid", "Second rule is #testid.");
- ok(!ruleEditor.expander.getAttribute("open"), "Expander is closed.");
- ok(ruleEditor.container.classList.contains("ruleview-highlight"),
- "margin text property is correctly highlighted.");
- ok(!computed.hasAttribute("filter-open"), "margin computed list is closed.");
-
- ok(computed.children[0].classList.contains("ruleview-highlight"),
- "margin-top computed property is correctly highlighted.");
- ok(computed.children[1].classList.contains("ruleview-highlight"),
- "margin-right computed property is correctly highlighted.");
- ok(computed.children[2].classList.contains("ruleview-highlight"),
- "margin-bottom computed property is correctly highlighted.");
- ok(computed.children[3].classList.contains("ruleview-highlight"),
- "margin-left computed property is correctly highlighted.");
-}
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_search-filter-computed-list_07.js b/browser/devtools/styleinspector/test/browser_ruleview_search-filter-computed-list_07.js
deleted file mode 100644
index fb555578415..00000000000
--- a/browser/devtools/styleinspector/test/browser_ruleview_search-filter-computed-list_07.js
+++ /dev/null
@@ -1,55 +0,0 @@
-/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-// Tests that the rule view search filter works properly in the computed list
-// for color values.
-
-const SEARCH = "background-color: #F3F3F3";
-
-const TEST_URI = `
-
-
Styled Node
-`;
-
-add_task(function*() {
- yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
- let {inspector, view} = yield openRuleView();
- yield selectNode(".testclass", inspector);
- yield testAddTextInFilter(inspector, view);
-});
-
-function* testAddTextInFilter(inspector, ruleView) {
- info("Setting filter text to \"" + SEARCH + "\"");
-
- let win = ruleView.styleWindow;
- let searchField = ruleView.searchField;
- let onRuleViewFiltered = inspector.once("ruleview-filtered");
-
- searchField.focus();
- synthesizeKeys(SEARCH, win);
- yield onRuleViewFiltered;
-
- info("Check that the correct rules are visible");
- is(ruleView.element.children.length, 2, "Should have 2 rules.");
- is(getRuleViewRuleEditor(ruleView, 0).rule.selectorText, "element",
- "First rule is inline element.");
-
- let rule = getRuleViewRuleEditor(ruleView, 1).rule;
- let ruleEditor = rule.textProps[0].editor;
- let computed = ruleEditor.computed;
-
- is(rule.selectorText, ".testclass", "Second rule is .testclass.");
- ok(ruleEditor.expander.getAttribute("open"), "Expander is open.");
- ok(!ruleEditor.container.classList.contains("ruleview-highlight"),
- "background property is not highlighted.");
- ok(computed.hasAttribute("filter-open"), "background computed list is open.");
- ok(computed.children[0].classList.contains("ruleview-highlight"),
- "background-color computed property is highlighted.");
-}
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_search-filter-computed-list_08.js b/browser/devtools/styleinspector/test/browser_ruleview_search-filter-computed-list_08.js
deleted file mode 100644
index 5f0360f9b9e..00000000000
--- a/browser/devtools/styleinspector/test/browser_ruleview_search-filter-computed-list_08.js
+++ /dev/null
@@ -1,70 +0,0 @@
-/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-// Tests that the rule view search filter works properly in the computed list
-// for newly modified property values.
-
-const SEARCH = "0px";
-
-const TEST_URI = `
-
-
Styled Node
-`;
-
-add_task(function*() {
- yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
- let {inspector, view} = yield openRuleView();
- yield selectNode("#testid", inspector);
- yield testModifyPropertyValueFilter(inspector, view);
-});
-
-function* testModifyPropertyValueFilter(inspector, view) {
- info("Setting filter text to \"" + SEARCH + "\"");
-
- let searchField = view.searchField;
- let onRuleViewFiltered = inspector.once("ruleview-filtered");
-
- searchField.focus();
- synthesizeKeys(SEARCH, view.styleWindow);
- yield onRuleViewFiltered;
-
- let rule = getRuleViewRuleEditor(view, 1).rule;
- let propEditor = rule.textProps[0].editor;
- let computed = propEditor.computed;
- let editor = yield focusEditableField(view, propEditor.valueSpan);
-
- info("Check that the correct rules are visible");
- is(rule.selectorText, "#testid", "Second rule is #testid.");
- ok(!propEditor.container.classList.contains("ruleview-highlight"),
- "margin text property is not highlighted.");
- ok(rule.textProps[1].editor.container.classList
- .contains("ruleview-highlight"),
- "top text property is correctly highlighted.");
-
- let onBlur = once(editor.input, "blur");
- let onModification = rule._applyingModifications;
- EventUtils.sendString("4px 0px", view.styleWindow);
- EventUtils.synthesizeKey("VK_RETURN", {});
- yield onBlur;
- yield onModification;
-
- ok(propEditor.container.classList.contains("ruleview-highlight"),
- "margin text property is correctly highlighted.");
- ok(!computed.hasAttribute("filter-open"), "margin computed list is closed.");
- ok(!computed.children[0].classList.contains("ruleview-highlight"),
- "margin-top computed property is not highlighted.");
- ok(computed.children[1].classList.contains("ruleview-highlight"),
- "margin-right computed property is correctly highlighted.");
- ok(!computed.children[2].classList.contains("ruleview-highlight"),
- "margin-bottom computed property is not highlighted.");
- ok(computed.children[3].classList.contains("ruleview-highlight"),
- "margin-left computed property is correctly highlighted.");
-}
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_search-filter-computed-list_clear.js b/browser/devtools/styleinspector/test/browser_ruleview_search-filter-computed-list_clear.js
deleted file mode 100644
index 23c11d65fc4..00000000000
--- a/browser/devtools/styleinspector/test/browser_ruleview_search-filter-computed-list_clear.js
+++ /dev/null
@@ -1,90 +0,0 @@
-/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-// Tests that the rule view search filter clear button works properly and clears
-// the highlighted rules in the computed list.
-
-const SEARCH = "0px";
-
-const TEST_URI = `
-
-
Styled Node
-`;
-
-add_task(function*() {
- yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
- let {inspector, view} = yield openRuleView();
- yield selectNode("#testid", inspector);
- yield testAddTextInFilter(inspector, view);
- yield testClearSearchFilter(inspector, view);
-});
-
-function* testAddTextInFilter(inspector, ruleView) {
- info("Setting filter text to \"" + SEARCH + "\"");
-
- let searchField = ruleView.searchField;
- let onRuleViewFiltered = inspector.once("ruleview-filtered");
-
- searchField.focus();
- synthesizeKeys(SEARCH, ruleView.styleWindow);
- yield onRuleViewFiltered;
-
- info("Check that the correct rules are visible");
- is(ruleView.element.children.length, 2, "Should have 2 rules.");
- is(getRuleViewRuleEditor(ruleView, 0).rule.selectorText, "element",
- "First rule is inline element.");
-
- let rule = getRuleViewRuleEditor(ruleView, 1).rule;
- let ruleEditor = rule.textProps[0].editor;
- let computed = ruleEditor.computed;
-
- is(rule.selectorText, "#testid", "Second rule is #testid.");
- ok(!ruleEditor.expander.getAttribute("open"), "Expander is closed.");
- ok(ruleEditor.container.classList.contains("ruleview-highlight"),
- "margin text property is correctly highlighted.");
- ok(!computed.hasAttribute("filter-open"), "margin computed list is closed.");
-
- ok(!computed.children[0].classList.contains("ruleview-highlight"),
- "margin-top computed property is not highlighted.");
- ok(computed.children[1].classList.contains("ruleview-highlight"),
- "margin-right computed property is correctly highlighted.");
- ok(!computed.children[2].classList.contains("ruleview-highlight"),
- "margin-bottom computed property is not highlighted.");
- ok(computed.children[3].classList.contains("ruleview-highlight"),
- "margin-left computed property is correctly highlighted.");
-}
-
-function* testClearSearchFilter(inspector, ruleView) {
- info("Clearing the search filter");
-
- let searchField = ruleView.searchField;
- let searchClearButton = ruleView.searchClearButton;
- let onRuleViewFiltered = inspector.once("ruleview-filtered");
-
- EventUtils.synthesizeMouseAtCenter(searchClearButton, {},
- ruleView.styleWindow);
-
- yield onRuleViewFiltered;
-
- info("Check the search filter is cleared and no rules are highlighted");
- is(ruleView.element.children.length, 3, "Should have 3 rules.");
- ok(!searchField.value, "Search filter is cleared");
- ok(!ruleView.styleDocument.querySelectorAll(".ruleview-highlight").length,
- "No rules are higlighted");
-
- let ruleEditor = getRuleViewRuleEditor(ruleView, 1).rule.textProps[0].editor;
- let computed = ruleEditor.computed;
-
- ok(!ruleEditor.expander.getAttribute("open"), "Expander is closed.");
- ok(!computed.hasAttribute("filter-open"), "margin computed list is closed.");
-}
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_search-filter-computed-list_expander.js b/browser/devtools/styleinspector/test/browser_ruleview_search-filter-computed-list_expander.js
index 650bb56396e..f1be5d0c656 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_search-filter-computed-list_expander.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_search-filter-computed-list_expander.js
@@ -29,24 +29,19 @@ add_task(function*() {
yield testClearSearchFilter(inspector, view);
});
-function* testOpenExpanderAndAddTextInFilter(inspector, ruleView) {
- let searchField = ruleView.searchField;
- let onRuleViewFiltered = inspector.once("ruleview-filtered");
- let rule = getRuleViewRuleEditor(ruleView, 1).rule;
+function* testOpenExpanderAndAddTextInFilter(inspector, view) {
+ let rule = getRuleViewRuleEditor(view, 1).rule;
let ruleEditor = rule.textProps[0].editor;
let computed = ruleEditor.computed;
info("Opening the computed list of margin property");
ruleEditor.expander.click();
- info("Setting filter text to \"" + SEARCH + "\"");
- searchField.focus();
- synthesizeKeys(SEARCH, ruleView.styleWindow);
- yield onRuleViewFiltered;
+ yield setSearchFilter(view, SEARCH);
info("Check that the correct rules are visible");
- is(ruleView.element.children.length, 2, "Should have 2 rules.");
- is(getRuleViewRuleEditor(ruleView, 0).rule.selectorText, "element",
+ is(view.element.children.length, 2, "Should have 2 rules.");
+ is(getRuleViewRuleEditor(view, 0).rule.selectorText, "element",
"First rule is inline element.");
is(rule.selectorText, "#testid", "Second rule is #testid.");
@@ -68,25 +63,25 @@ function* testOpenExpanderAndAddTextInFilter(inspector, ruleView) {
"margin-left computed property is correctly highlighted.");
}
-function* testClearSearchFilter(inspector, ruleView) {
+function* testClearSearchFilter(inspector, view) {
info("Clearing the search filter");
- let searchField = ruleView.searchField;
- let searchClearButton = ruleView.searchClearButton;
+ let searchField = view.searchField;
+ let searchClearButton = view.searchClearButton;
let onRuleViewFiltered = inspector.once("ruleview-filtered");
EventUtils.synthesizeMouseAtCenter(searchClearButton, {},
- ruleView.styleWindow);
+ view.styleWindow);
yield onRuleViewFiltered;
info("Check the search filter is cleared and no rules are highlighted");
- is(ruleView.element.children.length, 3, "Should have 3 rules.");
+ is(view.element.children.length, 3, "Should have 3 rules.");
ok(!searchField.value, "Search filter is cleared");
- ok(!ruleView.styleDocument.querySelectorAll(".ruleview-highlight").length,
+ ok(!view.styleDocument.querySelectorAll(".ruleview-highlight").length,
"No rules are higlighted");
- let ruleEditor = getRuleViewRuleEditor(ruleView, 1).rule.textProps[0].editor;
+ let ruleEditor = getRuleViewRuleEditor(view, 1).rule.textProps[0].editor;
let computed = ruleEditor.computed;
ok(ruleEditor.expander.getAttribute("open"), "Expander is open.");
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_search-filter_01.js b/browser/devtools/styleinspector/test/browser_ruleview_search-filter_01.js
index 056270a41ab..445d25fe636 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_search-filter_01.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_search-filter_01.js
@@ -4,14 +4,12 @@
"use strict";
-// Tests that the rule view search filter works properly for property values.
-
-const SEARCH = "00F";
+// Tests that the rule view search filter and clear button works properly.
const TEST_URI = `
-
Styled Node
-`;
+const SEARCH = "20%";
+const TEST_URI = TEST_URL_ROOT + "doc_keyframeanimation.html";
add_task(function*() {
- yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ yield addTab(TEST_URI);
let {inspector, view} = yield openRuleView();
- yield selectNode("#testid", inspector);
+ yield selectNode("#boxy", inspector);
yield testAddTextInFilter(inspector, view);
});
-function* testAddTextInFilter(inspector, ruleView) {
- info("Setting filter text to \"" + SEARCH + "\"");
-
- let win = ruleView.styleWindow;
- let searchField = ruleView.searchField;
- let onRuleViewFiltered = inspector.once("ruleview-filtered");
-
- searchField.focus();
- synthesizeKeys(SEARCH, win);
- yield onRuleViewFiltered;
+function* testAddTextInFilter(inspector, view) {
+ yield setSearchFilter(view, SEARCH);
info("Check that the correct rules are visible");
- is(ruleView.element.children.length, 2, "Should have 2 rules.");
- is(getRuleViewRuleEditor(ruleView, 0).rule.selectorText, "element",
+ is(getRuleViewRuleEditor(view, 0).rule.selectorText, "element",
"First rule is inline element.");
- let rule = getRuleViewRuleEditor(ruleView, 1).rule;
+ let ruleEditor = getRuleViewRuleEditor(view, 2, 0);
- is(rule.selectorText, "#testid", "Second rule is #testid.");
- ok(rule.textProps[1].editor.container.classList
- .contains("ruleview-highlight"),
- "background-color text property is correctly highlighted.");
+ is(ruleEditor.rule.domRule.keyText, "20%", "Second rule is 20%.");
+ ok(ruleEditor.selectorText.classList.contains("ruleview-highlight"),
+ "20% selector is highlighted.");
}
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_search-filter_03.js b/browser/devtools/styleinspector/test/browser_ruleview_search-filter_03.js
index aee783c8ed8..93ab20ed616 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_search-filter_03.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_search-filter_03.js
@@ -4,20 +4,17 @@
"use strict";
-// Tests that the rule view search filter works properly for rule selectors.
+// Tests that the rule view search filter works properly for inline styles.
-const SEARCH = "#test";
+const SEARCH = "color";
const TEST_URI = `
-
Styled Node
+
Styled Node
`;
add_task(function*() {
@@ -27,25 +24,16 @@ add_task(function*() {
yield testAddTextInFilter(inspector, view);
});
-function* testAddTextInFilter(inspector, ruleView) {
- info("Setting filter text to \"" + SEARCH + "\"");
-
- let win = ruleView.styleWindow;
- let searchField = ruleView.searchField;
- let onRuleViewFilter = inspector.once("ruleview-filtered");
-
- searchField.focus();
- synthesizeKeys(SEARCH, win);
- yield onRuleViewFilter;
+function* testAddTextInFilter(inspector, view) {
+ yield setSearchFilter(view, SEARCH);
info("Check that the correct rules are visible");
- is(ruleView.element.children.length, 2, "Should have 2 rules.");
- is(getRuleViewRuleEditor(ruleView, 0).rule.selectorText, "element",
- "First rule is inline element.");
+ is(view.element.children.length, 1, "Should have 1 rule.");
- let ruleEditor = getRuleViewRuleEditor(ruleView, 1);
+ let rule = getRuleViewRuleEditor(view, 0).rule;
- is(ruleEditor.rule.selectorText, "#testid", "Second rule is #testid.");
- ok(ruleEditor.selectorText.children[0].classList
- .contains("ruleview-highlight"), "#testid selector is highlighted.");
+ is(rule.selectorText, "element", "First rule is inline element.");
+ ok(rule.textProps[0].editor.container.classList
+ .contains("ruleview-highlight"),
+ "background-color text property is correctly highlighted.");
}
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_search-filter_04.js b/browser/devtools/styleinspector/test/browser_ruleview_search-filter_04.js
index d2f322e65f9..4b91d486df5 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_search-filter_04.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_search-filter_04.js
@@ -4,37 +4,73 @@
"use strict";
-// Tests that the rule view search filter works properly for keyframe rule
-// selectors.
+// Tests that the rule view search filter works properly when modifying the
+// existing search filter value.
-const SEARCH = "20%";
-const TEST_URI = TEST_URL_ROOT + "doc_keyframeanimation.html";
+const SEARCH = "00F";
+
+const TEST_URI = `
+
+
Styled Node
+`;
add_task(function*() {
- yield addTab(TEST_URI);
+ yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
let {inspector, view} = yield openRuleView();
- yield selectNode("#boxy", inspector);
+ yield selectNode("#testid", inspector);
yield testAddTextInFilter(inspector, view);
+ yield testRemoveTextInFilter(inspector, view);
});
-function* testAddTextInFilter(inspector, ruleView) {
- info("Setting filter text to \"" + SEARCH + "\"");
-
- let win = ruleView.styleWindow;
- let searchField = ruleView.searchField;
- let onRuleViewFilter = inspector.once("ruleview-filtered");
-
- searchField.focus();
- synthesizeKeys(SEARCH, win);
- yield onRuleViewFilter;
+function* testAddTextInFilter(inspector, view) {
+ yield setSearchFilter(view, SEARCH);
info("Check that the correct rules are visible");
- is(getRuleViewRuleEditor(ruleView, 0).rule.selectorText, "element",
+ is(view.element.children.length, 2, "Should have 2 rules.");
+ is(getRuleViewRuleEditor(view, 0).rule.selectorText, "element",
"First rule is inline element.");
- let ruleEditor = getRuleViewRuleEditor(ruleView, 2, 0);
+ let rule = getRuleViewRuleEditor(view, 1).rule;
- is(ruleEditor.rule.domRule.keyText, "20%", "Second rule is 20%.");
- ok(ruleEditor.selectorText.classList.contains("ruleview-highlight"),
- "20% selector is highlighted.");
+ is(rule.selectorText, "#testid", "Second rule is #testid.");
+ ok(rule.textProps[0].editor.container.classList
+ .contains("ruleview-highlight"),
+ "background-color text property is correctly highlighted.");
+}
+
+function* testRemoveTextInFilter(inspector, view) {
+ info("Press backspace and set filter text to \"00\"");
+
+ let win = view.styleWindow;
+ let searchField = view.searchField;
+
+ searchField.focus();
+ EventUtils.synthesizeKey("VK_BACK_SPACE", {}, win);
+ yield inspector.once("ruleview-filtered");
+
+ info("Check that the correct rules are visible");
+ is(view.element.children.length, 3, "Should have 3 rules.");
+ is(getRuleViewRuleEditor(view, 0).rule.selectorText, "element",
+ "First rule is inline element.");
+
+ let rule = getRuleViewRuleEditor(view, 1).rule;
+
+ is(rule.selectorText, "#testid", "Second rule is #testid.");
+ ok(rule.textProps[0].editor.container.classList
+ .contains("ruleview-highlight"),
+ "background-color text property is correctly highlighted.");
+
+ rule = getRuleViewRuleEditor(view, 2).rule;
+
+ is(rule.selectorText, ".testclass", "Second rule is .testclass.");
+ ok(rule.textProps[0].editor.container.classList
+ .contains("ruleview-highlight"),
+ "width text property is correctly highlighted.");
}
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_search-filter_05.js b/browser/devtools/styleinspector/test/browser_ruleview_search-filter_05.js
index 138a3c3d872..73317fa90ea 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_search-filter_05.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_search-filter_05.js
@@ -4,50 +4,30 @@
"use strict";
-// Tests that the rule view search filter works properly for multiple rule
-// selectors.
+// Tests that the rule view search filter works properly for stylesheet source.
-const SEARCH = "body";
-
-const TEST_URI = `
-
-
Styled Node
-`;
+const SEARCH = "doc_urls_clickable.css";
+const TEST_URI = TEST_URL_ROOT + "doc_urls_clickable.html";
add_task(function*() {
- yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ yield addTab(TEST_URI);
let {inspector, view} = yield openRuleView();
- yield selectNode("#testid", inspector);
+ yield selectNode(".relative1", inspector);
yield testAddTextInFilter(inspector, view);
});
-function* testAddTextInFilter(inspector, ruleView) {
- info("Setting filter text to \"" + SEARCH + "\"");
-
- let win = ruleView.styleWindow;
- let searchField = ruleView.searchField;
- let onRuleViewFilter = inspector.once("ruleview-filtered");
-
- searchField.focus();
- synthesizeKeys(SEARCH, win);
- yield onRuleViewFilter;
+function* testAddTextInFilter(inspector, view) {
+ yield setSearchFilter(view, SEARCH);
info("Check that the correct rules are visible");
- is(ruleView.element.children.length, 2, "Should have 2 rules.");
- is(getRuleViewRuleEditor(ruleView, 0).rule.selectorText, "element",
+ is(view.element.children.length, 2, "Should have 2 rules.");
+ is(getRuleViewRuleEditor(view, 0).rule.selectorText, "element",
"First rule is inline element.");
- let ruleEditor = getRuleViewRuleEditor(ruleView, 1);
+ let rule = getRuleViewRuleEditor(view, 1).rule;
+ let source = rule.textProps[0].editor.ruleEditor.source;
- is(ruleEditor.rule.selectorText, "html, body, div",
- "Second rule is html, body, div.");
- ok(ruleEditor.selectorText.children[2].classList
- .contains("ruleview-highlight"), "body selector is highlighted.");
+ is(rule.selectorText, ".relative1", "Second rule is .relative1.");
+ ok(source.classList.contains("ruleview-highlight"),
+ "stylesheet source is correctly highlighted.");
}
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_search-filter_06.js b/browser/devtools/styleinspector/test/browser_ruleview_search-filter_06.js
index bd6a8d63578..64327c9e6e8 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_search-filter_06.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_search-filter_06.js
@@ -4,50 +4,24 @@
"use strict";
-// Tests that the rule view search filter works properly for property line
-// input.
+// Tests that the rule view search filter does not highlight the source with
+// input that could be parsed as a property line.
-const SEARCH = "background-color:#00F";
-
-const TEST_URI = `
-
-
Styled Node
-`;
+const SEARCH = "doc_urls_clickable.css: url";
+const TEST_URI = TEST_URL_ROOT + "doc_urls_clickable.html";
add_task(function*() {
- yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
+ yield addTab(TEST_URI);
let {inspector, view} = yield openRuleView();
- yield selectNode("#testid", inspector);
+ yield selectNode(".relative1", inspector);
yield testAddTextInFilter(inspector, view);
});
-function* testAddTextInFilter(inspector, ruleView) {
- info("Setting filter text to \"" + SEARCH + "\"");
-
- let win = ruleView.styleWindow;
- let searchField = ruleView.searchField;
- let onRuleViewFiltered = inspector.once("ruleview-filtered");
-
- searchField.focus();
- synthesizeKeys(SEARCH, win);
- yield onRuleViewFiltered;
+function* testAddTextInFilter(inspector, view) {
+ yield setSearchFilter(view, SEARCH);
info("Check that the correct rules are visible");
- is(ruleView.element.children.length, 2, "Should have 2 rules.");
- is(getRuleViewRuleEditor(ruleView, 0).rule.selectorText, "element",
+ is(view.element.children.length, 1, "Should have 1 rules.");
+ is(getRuleViewRuleEditor(view, 0).rule.selectorText, "element",
"First rule is inline element.");
-
- let rule = getRuleViewRuleEditor(ruleView, 1).rule;
-
- is(rule.selectorText, ".testclass", "Second rule is .testclass.");
- ok(rule.textProps[0].editor.container.classList
- .contains("ruleview-highlight"),
- "background-color text property is correctly highlighted.");
}
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_search-filter_07.js b/browser/devtools/styleinspector/test/browser_ruleview_search-filter_07.js
index fb806ffdb95..811965478c3 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_search-filter_07.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_search-filter_07.js
@@ -4,50 +4,52 @@
"use strict";
-// Tests that the rule view search filter works properly for parsed property
-// value.
+// Tests that the rule view search filter works properly for newly modified
+// property name.
-const SEARCH = ":00F";
+const SEARCH = "e";
const TEST_URI = `
-
-
Styled Node
+
Styled Node
`;
add_task(function*() {
yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
let {inspector, view} = yield openRuleView();
yield selectNode("#testid", inspector);
- yield testAddTextInFilter(inspector, view);
+ yield testModifyPropertyNameFilter(inspector, view);
});
-function* testAddTextInFilter(inspector, ruleView) {
- info("Setting filter text to \"" + SEARCH + "\"");
+function* testModifyPropertyNameFilter(inspector, view) {
+ yield setSearchFilter(view, SEARCH);
- let win = ruleView.styleWindow;
- let searchField = ruleView.searchField;
- let onRuleViewFiltered = inspector.once("ruleview-filtered");
-
- searchField.focus();
- synthesizeKeys(SEARCH, win);
- yield onRuleViewFiltered;
+ let ruleEditor = getRuleViewRuleEditor(view, 1);
+ let rule = ruleEditor.rule;
+ let propEditor = rule.textProps[0].editor;
+ let editor = yield focusEditableField(view, propEditor.nameSpan);
info("Check that the correct rules are visible");
- is(ruleView.element.children.length, 2, "Should have 2 rules.");
- is(getRuleViewRuleEditor(ruleView, 0).rule.selectorText, "element",
- "First rule is inline element.");
-
- let rule = getRuleViewRuleEditor(ruleView, 1).rule;
-
+ is(view.element.children.length, 2, "Should have 2 rules.");
is(rule.selectorText, "#testid", "Second rule is #testid.");
- ok(rule.textProps[0].editor.container.classList
+ ok(!propEditor.container.classList.contains("ruleview-highlight"),
+ "width text property is not highlighted.");
+ ok(rule.textProps[1].editor.container.classList
.contains("ruleview-highlight"),
- "background-color text property is correctly highlighted.");
+ "height text property is correctly highlighted.");
+
+ let onBlur = once(editor.input, "blur");
+ let onModification = rule._applyingModifications;
+ EventUtils.sendString("margin-left", view.styleWindow);
+ EventUtils.synthesizeKey("VK_RETURN", {});
+ yield onBlur;
+ yield onModification;
+
+ ok(propEditor.container.classList.contains("ruleview-highlight"),
+ "margin-left text property is correctly highlighted.");
}
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_search-filter_08.js b/browser/devtools/styleinspector/test/browser_ruleview_search-filter_08.js
index 62f23493125..8465ed145d3 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_search-filter_08.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_search-filter_08.js
@@ -4,50 +4,52 @@
"use strict";
-// Tests that the rule view search filter works properly for parsed property
-// name.
+// Tests that the rule view search filter works properly for newly modified
+// property value.
-const SEARCH = "background:";
+const SEARCH = "100%";
const TEST_URI = `
-
-
Styled Node
+
Styled Node
`;
add_task(function*() {
yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
let {inspector, view} = yield openRuleView();
yield selectNode("#testid", inspector);
- yield testAddTextInFilter(inspector, view);
+ yield testModifyPropertyValueFilter(inspector, view);
});
-function* testAddTextInFilter(inspector, ruleView) {
- info("Setting filter text to \"" + SEARCH + "\"");
+function* testModifyPropertyValueFilter(inspector, view) {
+ yield setSearchFilter(view, SEARCH);
- let win = ruleView.styleWindow;
- let searchField = ruleView.searchField;
- let onRuleViewFiltered = inspector.once("ruleview-filtered");
-
- searchField.focus();
- synthesizeKeys(SEARCH, win);
- yield onRuleViewFiltered;
+ let ruleEditor = getRuleViewRuleEditor(view, 1);
+ let rule = ruleEditor.rule;
+ let propEditor = rule.textProps[1].editor;
+ let editor = yield focusEditableField(view, propEditor.valueSpan);
info("Check that the correct rules are visible");
- is(ruleView.element.children.length, 2, "Should have 2 rules.");
- is(getRuleViewRuleEditor(ruleView, 0).rule.selectorText, "element",
- "First rule is inline element.");
-
- let rule = getRuleViewRuleEditor(ruleView, 1).rule;
-
+ is(view.element.children.length, 2, "Should have 2 rules.");
is(rule.selectorText, "#testid", "Second rule is #testid.");
ok(rule.textProps[0].editor.container.classList
.contains("ruleview-highlight"),
- "background-color text property is correctly highlighted.");
+ "width text property is correctly highlighted.");
+ ok(!propEditor.container.classList.contains("ruleview-highlight"),
+ "height text property is not highlighted.");
+
+ let onBlur = once(editor.input, "blur");
+ let onModification = rule._applyingModifications;
+ EventUtils.sendString("100%", view.styleWindow);
+ EventUtils.synthesizeKey("VK_RETURN", {});
+ yield onBlur;
+ yield onModification;
+
+ ok(propEditor.container.classList.contains("ruleview-highlight"),
+ "height text property is correctly highlighted.");
}
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_search-filter_09.js b/browser/devtools/styleinspector/test/browser_ruleview_search-filter_09.js
index 6cb6d436495..b2a73fa7b8a 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_search-filter_09.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_search-filter_09.js
@@ -4,44 +4,69 @@
"use strict";
-// Tests that the rule view search filter works properly for inline styles.
+// Tests that the rule view search filter works properly for newly added
+// property.
-const SEARCH = "color";
+const SEARCH = "100%";
const TEST_URI = `
-
-
Styled Node
+
Styled Node
`;
add_task(function*() {
yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
let {inspector, view} = yield openRuleView();
yield selectNode("#testid", inspector);
- yield testAddTextInFilter(inspector, view);
+ yield testNewPropertyFilter(inspector, view);
});
-function* testAddTextInFilter(inspector, ruleView) {
- info("Setting filter text to \"" + SEARCH + "\"");
+function* testNewPropertyFilter(inspector, view) {
+ yield setSearchFilter(view, SEARCH);
- let win = ruleView.styleWindow;
- let searchField = ruleView.searchField;
- let onRuleViewFiltered = inspector.once("ruleview-filtered");
-
- searchField.focus();
- synthesizeKeys(SEARCH, win);
- yield onRuleViewFiltered;
+ let ruleEditor = getRuleViewRuleEditor(view, 1);
+ let rule = ruleEditor.rule;
+ let editor = yield focusEditableField(view, ruleEditor.closeBrace);
info("Check that the correct rules are visible");
- is(ruleView.element.children.length, 1, "Should have 1 rule.");
-
- let rule = getRuleViewRuleEditor(ruleView, 0).rule;
-
- is(rule.selectorText, "element", "First rule is inline element.");
+ is(view.element.children.length, 2, "Should have 2 rules.");
+ is(rule.selectorText, "#testid", "Second rule is #testid.");
ok(rule.textProps[0].editor.container.classList
.contains("ruleview-highlight"),
- "background-color text property is correctly highlighted.");
+ "width text property is correctly highlighted.");
+ ok(!rule.textProps[1].editor.container.classList
+ .contains("ruleview-highlight"),
+ "height text property is not highlighted.");
+
+ info("Test creating a new property");
+
+ info("Entering margin-left in the property name editor");
+ editor.input.value = "margin-left";
+
+ info("Pressing return to commit and focus the new value field");
+ let onValueFocus = once(ruleEditor.element, "focus", true);
+ let onModifications = ruleEditor.rule._applyingModifications;
+ EventUtils.synthesizeKey("VK_RETURN", {}, view.styleWindow);
+ yield onValueFocus;
+ yield onModifications;
+
+ // Getting the new value editor after focus
+ editor = inplaceEditor(view.styleDocument.activeElement);
+ let propEditor = ruleEditor.rule.textProps[2].editor;
+
+ info("Entering a value and bluring the field to expect a rule change");
+ editor.input.value = "100%";
+ let onBlur = once(editor.input, "blur");
+ onModifications = ruleEditor.rule._applyingModifications;
+ editor.input.blur();
+ yield onBlur;
+ yield onModifications;
+
+ ok(propEditor.container.classList.contains("ruleview-highlight"),
+ "margin-left text property is correctly highlighted.");
}
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_search-filter_10.js b/browser/devtools/styleinspector/test/browser_ruleview_search-filter_10.js
index 51e92b0b455..fd0a003627a 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_search-filter_10.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_search-filter_10.js
@@ -4,81 +4,79 @@
"use strict";
-// Tests that the rule view search filter works properly when modifying the
-// existing search filter value
-
-const SEARCH = "00F";
+// Tests that the rule view search filter works properly for rule selectors.
const TEST_URI = `
Styled Node
`;
+const TEST_DATA = [
+ {
+ desc: "Tests that the search filter works properly for a single rule selector",
+ search: "#test",
+ selectorText: "#testid",
+ index: 0
+ },
+ {
+ desc: "Tests that the search filter works properly for multiple rule selectors",
+ search: "body",
+ selectorText: "html, body, div",
+ index: 2
+ }
+];
+
add_task(function*() {
yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
let {inspector, view} = yield openRuleView();
yield selectNode("#testid", inspector);
yield testAddTextInFilter(inspector, view);
- yield testRemoveTextInFilter(inspector, view);
});
-function* testAddTextInFilter(inspector, ruleView) {
- info("Setting filter text to \"" + SEARCH + "\"");
-
- let win = ruleView.styleWindow;
- let searchField = ruleView.searchField;
- let onRuleViewFiltered = inspector.once("ruleview-filtered");
-
- searchField.focus();
- synthesizeKeys(SEARCH, win);
- yield onRuleViewFiltered;
-
- info("Check that the correct rules are visible");
- is(ruleView.element.children.length, 2, "Should have 2 rules.");
- is(getRuleViewRuleEditor(ruleView, 0).rule.selectorText, "element",
- "First rule is inline element.");
-
- let rule = getRuleViewRuleEditor(ruleView, 1).rule;
-
- is(rule.selectorText, "#testid", "Second rule is #testid.");
- ok(rule.textProps[0].editor.container.classList
- .contains("ruleview-highlight"),
- "background-color text property is correctly highlighted.");
+function* testAddTextInFilter(inspector, view) {
+ for (let data of TEST_DATA) {
+ info(data.desc);
+ yield setSearchFilter(view, data.search);
+ yield checkRules(view, data);
+ yield clearSearchAndCheckRules(view);
+ }
}
-function* testRemoveTextInFilter(inspector, ruleView) {
- info("Press backspace and set filter text to \"00\"");
-
- let win = ruleView.styleWindow;
- let searchField = ruleView.searchField;
-
- searchField.focus();
- EventUtils.synthesizeKey("VK_BACK_SPACE", {}, win);
- yield inspector.once("ruleview-filtered");
-
+function* checkRules(view, data) {
info("Check that the correct rules are visible");
- is(ruleView.element.children.length, 3, "Should have 3 rules.");
- is(getRuleViewRuleEditor(ruleView, 0).rule.selectorText, "element",
+ is(view.element.children.length, 2, "Should have 2 rules.");
+ is(getRuleViewRuleEditor(view, 0).rule.selectorText, "element",
"First rule is inline element.");
- let rule = getRuleViewRuleEditor(ruleView, 1).rule;
+ let ruleEditor = getRuleViewRuleEditor(view, 1);
- is(rule.selectorText, "#testid", "Second rule is #testid.");
- ok(rule.textProps[0].editor.container.classList
+ is(ruleEditor.rule.selectorText, data.selectorText,
+ "Second rule is " + data.selectorText + ".");
+ ok(ruleEditor.selectorText.children[data.index].classList
.contains("ruleview-highlight"),
- "background-color text property is correctly highlighted.");
-
- rule = getRuleViewRuleEditor(ruleView, 2).rule;
-
- is(rule.selectorText, ".testclass", "Second rule is .testclass.");
- ok(rule.textProps[0].editor.container.classList
- .contains("ruleview-highlight"),
- "width text property is correctly highlighted.");
+ data.selectorText + " selector is highlighted.");
+}
+
+function* clearSearchAndCheckRules(view) {
+ let doc = view.styleDocument;
+ let win = view.styleWindow;
+ let searchField = view.searchField;
+ let searchClearButton = view.searchClearButton;
+
+ info("Clearing the search filter");
+ EventUtils.synthesizeMouseAtCenter(searchClearButton, {}, win);
+ yield view.inspector.once("ruleview-filtered");
+
+ 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.");
+ ok(!doc.querySelectorAll(".ruleview-highlight").length,
+ "No rules are higlighted.");
}
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_search-filter_11.js b/browser/devtools/styleinspector/test/browser_ruleview_search-filter_11.js
deleted file mode 100644
index 68cef34f239..00000000000
--- a/browser/devtools/styleinspector/test/browser_ruleview_search-filter_11.js
+++ /dev/null
@@ -1,52 +0,0 @@
-/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-// Tests that the rule view search filter can find "!important".
-
-const SEARCH = "!important";
-
-const TEST_URI = `
-
-
Styled Node
-`;
-
-add_task(function*() {
- yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
- let {inspector, view} = yield openRuleView();
- yield selectNode("#testid", inspector);
- yield testAddTextInFilter(inspector, view);
-});
-
-function* testAddTextInFilter(inspector, ruleView) {
- info("Setting filter text to \"" + SEARCH + "\"");
-
- let win = ruleView.styleWindow;
- let searchField = ruleView.searchField;
- let onRuleViewFiltered = inspector.once("ruleview-filtered");
-
- searchField.focus();
- synthesizeKeys(SEARCH, win);
- yield onRuleViewFiltered;
-
- info("Check that the correct rules are visible");
- is(ruleView.element.children.length, 2, "Should have 2 rules.");
- is(getRuleViewRuleEditor(ruleView, 0).rule.selectorText, "element",
- "First rule is inline element.");
-
- let rule = getRuleViewRuleEditor(ruleView, 1).rule;
-
- is(rule.selectorText, "#testid", "Second rule is #testid.");
- ok(rule.textProps[0].editor.container.classList
- .contains("ruleview-highlight"),
- "background-color text property is correctly highlighted.");
-}
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_search-filter_12.js b/browser/devtools/styleinspector/test/browser_ruleview_search-filter_12.js
deleted file mode 100644
index 3fe1e124ba1..00000000000
--- a/browser/devtools/styleinspector/test/browser_ruleview_search-filter_12.js
+++ /dev/null
@@ -1,41 +0,0 @@
-/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-// Tests that the rule view search filter works properly for stylesheet source.
-
-const SEARCH = "doc_urls_clickable.css";
-const TEST_URI = TEST_URL_ROOT + "doc_urls_clickable.html";
-
-add_task(function*() {
- yield addTab(TEST_URI);
- let {inspector, view} = yield openRuleView();
- yield selectNode(".relative1", inspector);
- yield testAddTextInFilter(inspector, view);
-});
-
-function* testAddTextInFilter(inspector, ruleView) {
- info("Setting filter text to \"" + SEARCH + "\"");
-
- let win = ruleView.styleWindow;
- let searchField = ruleView.searchField;
- let onRuleViewFiltered = inspector.once("ruleview-filtered");
-
- searchField.focus();
- synthesizeKeys(SEARCH, win);
- yield onRuleViewFiltered;
-
- info("Check that the correct rules are visible");
- is(ruleView.element.children.length, 2, "Should have 2 rules.");
- is(getRuleViewRuleEditor(ruleView, 0).rule.selectorText, "element",
- "First rule is inline element.");
-
- let rule = getRuleViewRuleEditor(ruleView, 1).rule;
- let source = rule.textProps[0].editor.ruleEditor.source;
-
- is(rule.selectorText, ".relative1", "Second rule is .relative1.");
- ok(source.classList.contains("ruleview-highlight"),
- "stylesheet source is correctly highlighted.");
-}
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_search-filter_13.js b/browser/devtools/styleinspector/test/browser_ruleview_search-filter_13.js
deleted file mode 100644
index 332d924becc..00000000000
--- a/browser/devtools/styleinspector/test/browser_ruleview_search-filter_13.js
+++ /dev/null
@@ -1,35 +0,0 @@
-/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-// Tests that the rule view search filter does not highlight the source with
-// input that could be parsed as a property line.
-
-const SEARCH = "doc_urls_clickable.css: url";
-const TEST_URI = TEST_URL_ROOT + "doc_urls_clickable.html";
-
-add_task(function*() {
- yield addTab(TEST_URI);
- let {inspector, view} = yield openRuleView();
- yield selectNode(".relative1", inspector);
- yield testAddTextInFilter(inspector, view);
-});
-
-function* testAddTextInFilter(inspector, ruleView) {
- info("Setting filter text to \"" + SEARCH + "\"");
-
- let win = ruleView.styleWindow;
- let searchField = ruleView.searchField;
- let onRuleViewFiltered = inspector.once("ruleview-filtered");
-
- searchField.focus();
- synthesizeKeys(SEARCH, win);
- yield onRuleViewFiltered;
-
- info("Check that the correct rules are visible");
- is(ruleView.element.children.length, 1, "Should have 1 rules.");
- is(getRuleViewRuleEditor(ruleView, 0).rule.selectorText, "element",
- "First rule is inline element.");
-}
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_search-filter_14.js b/browser/devtools/styleinspector/test/browser_ruleview_search-filter_14.js
deleted file mode 100644
index 8b5327b4095..00000000000
--- a/browser/devtools/styleinspector/test/browser_ruleview_search-filter_14.js
+++ /dev/null
@@ -1,62 +0,0 @@
-/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-// Tests that the rule view search filter works properly for newly modified
-// property value.
-
-const SEARCH = "100%";
-
-const TEST_URI = `
-
-
Styled Node
-`;
-
-add_task(function*() {
- yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
- let {inspector, view} = yield openRuleView();
- yield selectNode("#testid", inspector);
- yield testModifyPropertyValueFilter(inspector, view);
-});
-
-function* testModifyPropertyValueFilter(inspector, view) {
- info("Setting filter text to \"" + SEARCH + "\"");
-
- let searchField = view.searchField;
- let onvRuleViewFiltered = inspector.once("ruleview-filtered");
-
- searchField.focus();
- synthesizeKeys(SEARCH, view.styleWindow);
- yield onvRuleViewFiltered;
-
- let ruleEditor = getRuleViewRuleEditor(view, 1);
- let rule = ruleEditor.rule;
- let propEditor = rule.textProps[1].editor;
- let editor = yield focusEditableField(view, propEditor.valueSpan);
-
- info("Check that the correct rules are visible");
- is(view.element.children.length, 2, "Should have 2 rules.");
- is(rule.selectorText, "#testid", "Second rule is #testid.");
- ok(rule.textProps[0].editor.container.classList
- .contains("ruleview-highlight"),
- "width text property is correctly highlighted.");
- ok(!propEditor.container.classList.contains("ruleview-highlight"),
- "height text property is not highlighted.");
-
- let onBlur = once(editor.input, "blur");
- let onModification = rule._applyingModifications;
- EventUtils.sendString("100%", view.styleWindow);
- EventUtils.synthesizeKey("VK_RETURN", {});
- yield onBlur;
- yield onModification;
-
- ok(propEditor.container.classList.contains("ruleview-highlight"),
- "height text property is correctly highlighted.");
-}
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_search-filter_15.js b/browser/devtools/styleinspector/test/browser_ruleview_search-filter_15.js
deleted file mode 100644
index 0b43a0f8670..00000000000
--- a/browser/devtools/styleinspector/test/browser_ruleview_search-filter_15.js
+++ /dev/null
@@ -1,62 +0,0 @@
-/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-// Tests that the rule view search filter works properly for newly modified
-// property name.
-
-const SEARCH = "e";
-
-const TEST_URI = `
-
-
Styled Node
-`;
-
-add_task(function*() {
- yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
- let {inspector, view} = yield openRuleView();
- yield selectNode("#testid", inspector);
- yield testModifyPropertyNameFilter(inspector, view);
-});
-
-function* testModifyPropertyNameFilter(inspector, view) {
- info("Setting filter text to \"" + SEARCH + "\"");
-
- let searchField = view.searchField;
- let onRuleViewFiltered = inspector.once("ruleview-filtered");
-
- searchField.focus();
- synthesizeKeys(SEARCH, view.styleWindow);
- yield onRuleViewFiltered;
-
- let ruleEditor = getRuleViewRuleEditor(view, 1);
- let rule = ruleEditor.rule;
- let propEditor = rule.textProps[0].editor;
- let editor = yield focusEditableField(view, propEditor.nameSpan);
-
- info("Check that the correct rules are visible");
- is(view.element.children.length, 2, "Should have 2 rules.");
- is(rule.selectorText, "#testid", "Second rule is #testid.");
- ok(!propEditor.container.classList.contains("ruleview-highlight"),
- "width text property is not highlighted.");
- ok(rule.textProps[1].editor.container.classList
- .contains("ruleview-highlight"),
- "height text property is correctly highlighted.");
-
- let onBlur = once(editor.input, "blur");
- let onModification = rule._applyingModifications;
- EventUtils.sendString("margin-left", view.styleWindow);
- EventUtils.synthesizeKey("VK_RETURN", {});
- yield onBlur;
- yield onModification;
-
- ok(propEditor.container.classList.contains("ruleview-highlight"),
- "margin-left text property is correctly highlighted.");
-}
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_search-filter_16.js b/browser/devtools/styleinspector/test/browser_ruleview_search-filter_16.js
deleted file mode 100644
index d7a535777f9..00000000000
--- a/browser/devtools/styleinspector/test/browser_ruleview_search-filter_16.js
+++ /dev/null
@@ -1,79 +0,0 @@
-/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-// Tests that the rule view search filter works properly for newly added
-// property.
-
-const SEARCH = "100%";
-
-const TEST_URI = `
-
-
Styled Node
-`;
-
-add_task(function*() {
- yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
- let {inspector, view} = yield openRuleView();
- yield selectNode("#testid", inspector);
- yield testNewPropertyFilter(inspector, view);
-});
-
-function* testNewPropertyFilter(inspector, view) {
- info("Setting filter text to \"" + SEARCH + "\"");
-
- let searchField = view.searchField;
- let onRuleViewFiltered = inspector.once("ruleview-filtered");
-
- searchField.focus();
- synthesizeKeys(SEARCH, view.styleWindow);
- yield onRuleViewFiltered;
-
- let ruleEditor = getRuleViewRuleEditor(view, 1);
- let rule = ruleEditor.rule;
- let editor = yield focusEditableField(view, ruleEditor.closeBrace);
-
- info("Check that the correct rules are visible");
- is(view.element.children.length, 2, "Should have 2 rules.");
- is(rule.selectorText, "#testid", "Second rule is #testid.");
- ok(rule.textProps[0].editor.container.classList
- .contains("ruleview-highlight"),
- "width text property is correctly highlighted.");
- ok(!rule.textProps[1].editor.container.classList
- .contains("ruleview-highlight"),
- "height text property is not highlighted.");
-
- info("Test creating a new property");
-
- info("Entering margin-left in the property name editor");
- editor.input.value = "margin-left";
-
- info("Pressing return to commit and focus the new value field");
- let onValueFocus = once(ruleEditor.element, "focus", true);
- let onModifications = ruleEditor.rule._applyingModifications;
- EventUtils.synthesizeKey("VK_RETURN", {}, view.styleWindow);
- yield onValueFocus;
- yield onModifications;
-
- // Getting the new value editor after focus
- editor = inplaceEditor(view.styleDocument.activeElement);
- let propEditor = ruleEditor.rule.textProps[2].editor;
-
- info("Entering a value and bluring the field to expect a rule change");
- editor.input.value = "100%";
- let onBlur = once(editor.input, "blur");
- onModifications = ruleEditor.rule._applyingModifications;
- editor.input.blur();
- yield onBlur;
- yield onModifications;
-
- ok(propEditor.container.classList.contains("ruleview-highlight"),
- "margin-left text property is correctly highlighted.");
-}
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_search-filter_clear.js b/browser/devtools/styleinspector/test/browser_ruleview_search-filter_clear.js
deleted file mode 100644
index 8ffd1b55a16..00000000000
--- a/browser/devtools/styleinspector/test/browser_ruleview_search-filter_clear.js
+++ /dev/null
@@ -1,73 +0,0 @@
-/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-// Tests that the rule view search filter clear button works properly.
-
-const SEARCH = "00F";
-
-const TEST_URI = `
-
-
Styled Node
-`;
-
-add_task(function*() {
- yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
- let {inspector, view} = yield openRuleView();
- yield selectNode("#testid", inspector);
- yield testAddTextInFilter(inspector, view);
- yield testClearSearchFilter(inspector, view);
-});
-
-function* testAddTextInFilter(inspector, ruleView) {
- info("Setting filter text to \"" + SEARCH + "\"");
-
- let win = ruleView.styleWindow;
- let searchField = ruleView.searchField;
- let onRuleViewFiltered = inspector.once("ruleview-filtered");
-
- searchField.focus();
- synthesizeKeys(SEARCH, win);
- yield onRuleViewFiltered;
-
- info("Check that the correct rules are visible");
- is(ruleView.element.children.length, 2, "Should have 2 rules.");
- is(getRuleViewRuleEditor(ruleView, 0).rule.selectorText, "element",
- "First rule is inline element.");
-
- let rule = getRuleViewRuleEditor(ruleView, 1).rule;
-
- is(rule.selectorText, "#testid", "Second rule is #testid.");
- ok(rule.textProps[0].editor.container.classList
- .contains("ruleview-highlight"),
- "background-color text property is correctly highlighted.");
-}
-
-function* testClearSearchFilter(inspector, ruleView) {
- info("Clearing the search filter");
-
- let doc = ruleView.styleDocument;
- let win = ruleView.styleWindow;
- let searchField = ruleView.searchField;
- let searchClearButton = ruleView.searchClearButton;
- let onRuleViewFiltered = inspector.once("ruleview-filtered");
-
- EventUtils.synthesizeMouseAtCenter(searchClearButton, {}, win);
-
- yield onRuleViewFiltered;
-
- info("Check the search filter is cleared and no rules are highlighted");
- is(ruleView.element.children.length, 3, "Should have 3 rules.");
- ok(!searchField.value, "Search filter is cleared");
- ok(!doc.querySelectorAll(".ruleview-highlight").length,
- "No rules are higlighted");
-}
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_search-filter_escape-keypress.js b/browser/devtools/styleinspector/test/browser_ruleview_search-filter_escape-keypress.js
index c0c1f3375e3..87164077e37 100644
--- a/browser/devtools/styleinspector/test/browser_ruleview_search-filter_escape-keypress.js
+++ b/browser/devtools/styleinspector/test/browser_ruleview_search-filter_escape-keypress.js
@@ -7,6 +7,8 @@
// Tests that the rule view search filter escape keypress will clear the search
// field.
+const SEARCH = "00F";
+
const TEST_URI = `