diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /browser/base/content/test/urlbar/browser_search_favicon.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'browser/base/content/test/urlbar/browser_search_favicon.js')
-rw-r--r-- | browser/base/content/test/urlbar/browser_search_favicon.js | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/browser/base/content/test/urlbar/browser_search_favicon.js b/browser/base/content/test/urlbar/browser_search_favicon.js new file mode 100644 index 000000000..a8e6dbbcd --- /dev/null +++ b/browser/base/content/test/urlbar/browser_search_favicon.js @@ -0,0 +1,52 @@ +var gOriginalEngine; +var gEngine; +var gRestyleSearchesPref = "browser.urlbar.restyleSearches"; + +registerCleanupFunction(() => { + Services.prefs.clearUserPref(gRestyleSearchesPref); + Services.search.currentEngine = gOriginalEngine; + Services.search.removeEngine(gEngine); + return PlacesTestUtils.clearHistory(); +}); + +add_task(function*() { + Services.prefs.setBoolPref(gRestyleSearchesPref, true); +}); + +add_task(function*() { + + Services.search.addEngineWithDetails("SearchEngine", "", "", "", + "GET", "http://s.example.com/search"); + gEngine = Services.search.getEngineByName("SearchEngine"); + gEngine.addParam("q", "{searchTerms}", null); + gOriginalEngine = Services.search.currentEngine; + Services.search.currentEngine = gEngine; + + let uri = NetUtil.newURI("http://s.example.com/search?q=foo&client=1"); + yield PlacesTestUtils.addVisits({ uri: uri, title: "Foo - SearchEngine Search" }); + + yield BrowserTestUtils.openNewForegroundTab(gBrowser, "about:mozilla"); + + // The first autocomplete result has the action searchengine, while + // the second result is the "search favicon" element. + yield promiseAutocompleteResultPopup("foo"); + let result = gURLBar.popup.richlistbox.children[1]; + + isnot(result, null, "Expect a search result"); + is(result.getAttribute("type"), "searchengine", "Expect correct `type` attribute"); + + let titleHbox = result._titleText.parentNode.parentNode; + ok(titleHbox.classList.contains("ac-title"), "Title hbox sanity check"); + is_element_visible(titleHbox, "Title element should be visible"); + + let urlHbox = result._urlText.parentNode.parentNode; + ok(urlHbox.classList.contains("ac-url"), "URL hbox sanity check"); + is_element_hidden(urlHbox, "URL element should be hidden"); + + let actionHbox = result._actionText.parentNode.parentNode; + ok(actionHbox.classList.contains("ac-action"), "Action hbox sanity check"); + is_element_hidden(actionHbox, "Action element should be hidden because it is not selected"); + is(result._actionText.textContent, "Search with SearchEngine", "Action text should be as expected"); + + gBrowser.removeCurrentTab(); +}); |