Bug 805325 - Use the actual search engine name for logo's alt text on about:home, instead of the string "undefined". r=mak
authorDaniel Holbert <dholbert@cs.stanford.edu>
Thu, 25 Oct 2012 07:18:07 -0700
changeset 111515 a46d4906eee8d1db1a48f4fed5f6afd1cc292f8e
parent 111514 0a2a5585313d8d80d4f667b90957229e3c88474f
child 111516 321ee246dc593e22d31d3a63109269e19dc6b213
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersmak
bugs805325
milestone19.0a1
Bug 805325 - Use the actual search engine name for logo's alt text on about:home, instead of the string "undefined". r=mak
browser/base/content/abouthome/aboutHome.js
browser/base/content/test/browser_aboutHome.js
--- a/browser/base/content/abouthome/aboutHome.js
+++ b/browser/base/content/abouthome/aboutHome.js
@@ -139,17 +139,17 @@ function setupSearchEngine()
   // Add search engine logo.
   if (searchEngineInfo.image) {
     let logoElt = document.getElementById("searchEngineLogo");
     logoElt.src = searchEngineInfo.image;
 #ifdef XP_MACOSX
     if (searchEngineInfo.imageHD && window.matchMedia("(min-resolution: 2dppx)"))
       logoElt.src = searchEngineInfo.imageHD;
 #endif
-    logoElt.alt = searchEngineInfo.name;
+    logoElt.alt = searchEngineName;
   }
 
   // The "autofocus" attribute doesn't focus the form element
   // immediately when the element is first drawn, so the
   // attribute is also used for styling when the page first loads.
   let searchText = document.getElementById("searchText");
   searchText.addEventListener("blur", function searchText_onBlur() {
     searchText.removeEventListener("blur", searchText_onBlur);
--- a/browser/base/content/test/browser_aboutHome.js
+++ b/browser/base/content/test/browser_aboutHome.js
@@ -62,16 +62,38 @@ let gTests = [
     ok(snippetsElt, "Found snippets element");
     is(snippetsElt.getElementsByTagName("span").length, 1,
        "A default snippet is visible.");
     let storage = getStorage();
     storage.removeItem("snippets");
     executeSoon(runNextTest);
   }
 },
+{
+  desc: "Check that search engine logo has alt text",
+  setup: function ()
+  {
+  },
+  run: function ()
+  {
+    let doc = gBrowser.selectedTab.linkedBrowser.contentDocument;
+
+    let searchEngineLogoElt = doc.getElementById("searchEngineLogo");
+    ok(searchEngineLogoElt, "Found search engine logo");
+
+    let altText = searchEngineLogoElt.alt;
+    ok(typeof altText == "string" && altText.length > 0,
+       "Search engine logo's alt text is a nonempty string");
+
+    isnot(altText, "undefined",
+          "Search engine logo's alt text shouldn't be the string 'undefined'");
+
+    executeSoon(runNextTest);
+  }
+},
 ];
 
 function test()
 {
   waitForExplicitFinish();
 
   // Ensure that by default we don't try to check for remote snippets since that
   // could be tricky due to network bustages or slowness.