Bug 1533294 - Changing categories should hide the search-headers. r=Gijs
authorJared Wein <jwein@mozilla.com>
Thu, 28 Mar 2019 10:59:44 +0000
changeset 466716 401af0fbedf390d4fdc42943a260e58462a740ea
parent 466715 ed043ad65ad1076b398d1b4b45db62140e77aedc
child 466717 6b750ad7365d9c8c3f7b357e175d743c79744995
child 466728 04bd7929b499d25fc538e516fc3de1aa6e9d79dc
child 466730 4eb705fd67f69c8596331f06b9dbf4df078ff240
push id112594
push userccoroiu@mozilla.com
push dateFri, 29 Mar 2019 09:50:48 +0000
treeherdermozilla-inbound@6b750ad7365d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs
bugs1533294
milestone68.0a1
first release with
nightly linux32
401af0fbedf3 / 68.0a1 / 20190329094433 / files
nightly linux64
401af0fbedf3 / 68.0a1 / 20190329094433 / files
nightly mac
401af0fbedf3 / 68.0a1 / 20190329094433 / files
nightly win32
401af0fbedf3 / 68.0a1 / 20190329094433 / files
nightly win64
401af0fbedf3 / 68.0a1 / 20190329094433 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1533294 - Changing categories should hide the search-headers. r=Gijs Differential Revision: https://phabricator.services.mozilla.com/D25188
browser/components/preferences/in-content/preferences.js
browser/components/preferences/in-content/tests/browser_search_within_preferences_1.js
--- a/browser/components/preferences/in-content/preferences.js
+++ b/browser/components/preferences/in-content/preferences.js
@@ -178,16 +178,21 @@ async function gotoPref(aCategory) {
 
   // Updating the hash (below) or changing the selected category
   // will re-enter gotoPref.
   if (gLastCategory.category == category && !subcategory)
     return;
 
   let item;
   if (category != "paneSearchResults") {
+    // Hide second level headers in normal view
+    for (let element of document.querySelectorAll(".search-header")) {
+      element.hidden = true;
+    }
+
     item = categories.querySelector(".category[value=" + category + "]");
     if (!item) {
       category = kDefaultCategoryInternalName;
       item = categories.querySelector(".category[value=" + category + "]");
     }
   }
 
   if (gLastCategory.category || category != kDefaultCategoryInternalName || subcategory) {
--- a/browser/components/preferences/in-content/tests/browser_search_within_preferences_1.js
+++ b/browser/components/preferences/in-content/tests/browser_search_within_preferences_1.js
@@ -217,29 +217,36 @@ add_task(async function exiting_search_r
  */
 add_task(async function changing_tabs_after_searching() {
   await openPreferencesViaOpenPreferencesAPI("paneGeneral", { leaveOpen: true });
   let searchInput = gBrowser.contentDocument.getElementById("searchInput");
 
   is(searchInput, gBrowser.contentDocument.activeElement.closest("#searchInput"),
     "Search input should be focused when visiting preferences");
 
-  let query = "password";
+  let query = "permission";
   let searchCompletedPromise = BrowserTestUtils.waitForEvent(
     gBrowser.contentWindow, "PreferencesSearchCompleted", evt => evt.detail == query);
   EventUtils.sendString(query);
   await searchCompletedPromise;
 
+  // Search header should be shown for the permissions group
+  let permissionsSearchHeader = gBrowser.contentDocument.querySelector("#permissionsGroup .search-header");
+  is(permissionsSearchHeader.hidden, false, "Permissions search-header should be visible");
+
   let privacyCategory = gBrowser.contentDocument.getElementById("category-privacy");
   privacyCategory.click();
   is(searchInput.value, "", "search input should be empty");
   let categoriesList = gBrowser.contentDocument.getElementById("categories");
   for (let i = 0; i < categoriesList.childElementCount; i++) {
     let child = categoriesList.itemChildren[i];
     if (child.id == "category-privacy") {
       is(child.selected, true, "Privacy panel should be selected");
     } else if (child.id) {
       is(child.selected, false, "No other panel should be selected");
     }
   }
 
+  // Search header should now be hidden when viewing the permissions group not through a search
+  is(permissionsSearchHeader.hidden, true, "Permissions search-header should be hidden");
+
   BrowserTestUtils.removeTab(gBrowser.selectedTab);
 });