Bug 611459 - Search should default to searching for available add-ons. r=dtownsend a=blocking-final

This commit is contained in:
Mehdi Mulani 2011-01-07 14:21:38 -08:00
parent d588b9bd7f
commit 9ab02b028a
2 changed files with 31 additions and 1 deletions

View File

@ -324,7 +324,7 @@
<hbox id="search-filter" align="center">
<label id="search-filter-label" value="&search.filter2.label;"/>
<radiogroup id="search-filter-radiogroup" orient="horizontal"
align="center" persist="value" value="local">
align="center" persist="value" value="remote">
<radio id="search-filter-local" class="search-filter-radio"
label="&search.filter2.installed.label;" value="local"
tooltiptext="&search.filter2.installed.tooltip;"/>

View File

@ -340,6 +340,21 @@ add_test(function() {
// Tests that going back to search results works
add_test(function() {
// Before we open the add-ons manager, we should make sure that no filter
// has been set. If one is set, we remove it.
// This is for the check below, from bug 611459.
let RDF = Cc["@mozilla.org/rdf/rdf-service;1"].getService(Ci.nsIRDFService);
let store = RDF.GetDataSource("rdf:local-store");
let filterResource = RDF.GetResource("about:addons#search-filter-radiogroup");
let filterProperty = RDF.GetResource("value");
let filterTarget = store.GetTarget(filterResource, filterProperty, true);
if (filterTarget) {
is(filterTarget instanceof Ci.nsIRDFLiteral, true,
"Filter should be a value");
store.Unassert(filterResource, filterProperty, filterTarget);
}
open_manager("addons://list/extension", function(aManager) {
info("Part 1");
is_in_list(aManager, "addons://list/extension", false, false);
@ -350,6 +365,21 @@ add_test(function() {
EventUtils.synthesizeKey("VK_RETURN", {}, aManager);
wait_for_view_load(aManager, function(aManager) {
// Remote search is meant to be checked by default (bug 611459), so we
// confirm that and then switch to a local search.
var localFilter = aManager.document.getElementById("search-filter-local");
var remoteFilter = aManager.document.getElementById("search-filter-remote");
is(remoteFilter.selected, true, "Remote filter should be set by default");
var list = aManager.document.getElementById("search-list");
list.ensureElementIsVisible(localFilter);
EventUtils.synthesizeMouseAtCenter(localFilter, { }, aManager);
is(localFilter.selected, true, "Should have changed to local filter");
// Now we continue with the normal test.
info("Part 2");
is_in_search(aManager, "bar", true, false);
check_all_in_list(aManager, ["test2@tests.mozilla.org", "test3@tests.mozilla.org"]);