Bug 1101999 - Fix/add UITour highlighting for the new search UI. r=florian a=gavin
authorDave Townsend <dtownsend@oxymoronical.com>
Thu, 20 Nov 2014 12:13:21 -0800
changeset 234073 b1f228b6722539cde9f9dc07dc44c96e6640a21e
parent 234072 78772bd35440a96dadf4356d2ebd694c2e794ea1
child 234074 a87ab9d302eb36b70aa1b6d499dbb606e70cb45f
push id1
push usersledru@mozilla.com
push dateThu, 04 Dec 2014 17:57:20 +0000
reviewersflorian, gavin
bugs1101999
milestone35.0a2
Bug 1101999 - Fix/add UITour highlighting for the new search UI. r=florian a=gavin
browser/modules/UITour.jsm
browser/modules/test/browser_UITour_availableTargets.js
browser/modules/test/browser_UITour_panel_close_annotation.js
--- a/browser/modules/UITour.jsm
+++ b/browser/modules/UITour.jsm
@@ -113,22 +113,59 @@ this.UITour = {
     ["quit",        {query: "#PanelUI-quit"}],
     ["search",      {
       query: "#searchbar",
       widgetName: "search-container",
     }],
     ["searchProvider", {
       query: (aDocument) => {
         let searchbar = aDocument.getElementById("searchbar");
+        if (searchbar.hasAttribute("oneoffui")) {
+          return null;
+        }
         return aDocument.getAnonymousElementByAttribute(searchbar,
                                                         "anonid",
                                                         "searchbar-engine-button");
       },
       widgetName: "search-container",
     }],
+    ["searchIcon", {
+      query: (aDocument) => {
+        let searchbar = aDocument.getElementById("searchbar");
+        if (!searchbar.hasAttribute("oneoffui")) {
+          return null;
+        }
+        return aDocument.getAnonymousElementByAttribute(searchbar,
+                                                        "anonid",
+                                                        "searchbar-search-button");
+      },
+      widgetName: "search-container",
+    }],
+    ["searchPrefsLink", {
+      query: (aDocument) => {
+        let element = null;
+        let searchbar = aDocument.getElementById("searchbar");
+        if (searchbar.hasAttribute("oneoffui")) {
+          let popup = aDocument.getElementById("PopupSearchAutoComplete");
+          if (popup.state != "open")
+            return null;
+          element = aDocument.getAnonymousElementByAttribute(popup,
+                                                             "anonid",
+                                                             "search-settings");
+        } else {
+          element = aDocument.getAnonymousElementByAttribute(searchbar,
+                                                             "anonid",
+                                                             "open-engine-manager");
+        }
+        if (!element || !UITour.isElementVisible(element)) {
+          return null;
+        }
+        return element;
+      },
+    }],
     ["selectedTabIcon", {
       query: (aDocument) => {
         let selectedtab = aDocument.defaultView.gBrowser.selectedTab;
         let element = aDocument.getAnonymousElementByAttribute(selectedtab,
                                                                "anonid",
                                                                "tab-icon-image");
         if (!element || !UITour.isElementVisible(element)) {
           return null;
--- a/browser/modules/test/browser_UITour_availableTargets.js
+++ b/browser/modules/test/browser_UITour_availableTargets.js
@@ -36,17 +36,17 @@ let tests = [
         "help",
         "home",
         "loop",
         "devtools",
         "pinnedTab",
         "privateWindow",
         "quit",
         "search",
-        "searchProvider",
+        "searchIcon",
         "urlbar",
         ...searchEngineTargets(),
         ...(hasWebIDE ? ["webide"] : [])
       ]);
 
       ok(UITour.availableTargetsCache.has(window),
          "Targets should now be cached");
       done();
@@ -67,17 +67,17 @@ let tests = [
         "help",
         "loop",
         "devtools",
         "home",
         "pinnedTab",
         "privateWindow",
         "quit",
         "search",
-        "searchProvider",
+        "searchIcon",
         "urlbar",
         ...searchEngineTargets(),
         ...(hasWebIDE ? ["webide"] : [])
       ]);
 
       ok(UITour.availableTargetsCache.has(window),
          "Targets should now be cached again");
       CustomizableUI.reset();
@@ -87,17 +87,17 @@ let tests = [
     });
   },
 
   function test_availableTargets_exceptionFromGetTarget(done) {
     // The query function for the "search" target will throw if it's not found.
     // Make sure the callback still fires with the other available targets.
     CustomizableUI.removeWidgetFromArea("search-container");
     gContentAPI.getConfiguration("availableTargets", (data) => {
-      // Default minus "search" and "searchProvider"
+      // Default minus "search" and "searchProvider" and "searchIcon"
       ok_targets(data, [
         "accountStatus",
         "addons",
         "appMenu",
         "backForward",
         "bookmarks",
         "customize",
         "help",
--- a/browser/modules/test/browser_UITour_panel_close_annotation.js
+++ b/browser/modules/test/browser_UITour_panel_close_annotation.js
@@ -55,17 +55,17 @@ let tests = [
         ok(tooltip.state == "showing" || tooltip.state == "open", "The info panel should have remained open");
         done();
       }, "Highlight should have disappeared when panel closed");
     }, "Highlight should be shown after showHighlight() for fixed panel items");
   },
 
   function test_highlight_panel_click_find(done) {
     gContentAPI.showHighlight("help");
-    gContentAPI.showInfo("searchProvider", "test title", "test text");
+    gContentAPI.showInfo("searchIcon", "test title", "test text");
     waitForElementToBeVisible(highlight, function checkPanelIsOpen() {
       isnot(PanelUI.panel.state, "closed", "Panel should have opened");
 
       // Click the find button which should close the panel.
       let findButton = document.getElementById("find-button");
       EventUtils.synthesizeMouseAtCenter(findButton, {});
       waitForElementToBeHidden(highlight, function checkPanelIsClosed() {
         isnot(PanelUI.panel.state, "open",