Skip to content
This repository has been archived by the owner on Feb 29, 2020. It is now read-only.

Commit

Permalink
Fix Bug 1483257 - update search shortcuts when enabling experiment (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
rlr authored and Mardak committed Aug 14, 2018
1 parent f7f1e45 commit b2d7f56
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/TopSitesFeed.jsm
Expand Up @@ -648,7 +648,9 @@ this.TopSitesFeed = class TopSitesFeed {
this.refresh({broadcast: true});
break;
case SEARCH_SHORTCUTS_EXPERIMENT:
if (!action.data.value) {
if (action.data.value) {
this.updateCustomSearchShortcuts();
} else {
this.disableSearchImprovements();
}
this.refresh({broadcast: true});
Expand Down
10 changes: 10 additions & 0 deletions test/unit/lib/TopSitesFeed.test.js
Expand Up @@ -1236,6 +1236,16 @@ describe("Top Sites Feed", () => {
assert.deepEqual(fakeNewTabUtils.pinnedLinks.links[3], {url: "https://dontunpinme.com"});
});

it("should updateCustomSearchShortcuts when experiment pref is turned on", async () => {
feed.store.state.Prefs.values[SEARCH_SHORTCUTS_EXPERIMENT_PREF] = false;
feed.updateCustomSearchShortcuts = sinon.spy();

// turn the experiment on
feed.onAction({type: at.PREF_CHANGED, data: {name: SEARCH_SHORTCUTS_EXPERIMENT_PREF, value: true}});

assert.calledOnce(feed.updateCustomSearchShortcuts);
});

it("should filter out default top sites that match a hostname of a search shortcut if previously blocked", async () => {
feed.refreshDefaults("https://amazon.ca");
fakeNewTabUtils.blockedLinks.links = [{url: "https://amazon.com"}];
Expand Down

0 comments on commit b2d7f56

Please sign in to comment.