diff options
Diffstat (limited to '')
-rw-r--r-- | browser/components/asrouter/tests/unit/ASRouter.test.js | 107 |
1 files changed, 0 insertions, 107 deletions
diff --git a/browser/components/asrouter/tests/unit/ASRouter.test.js b/browser/components/asrouter/tests/unit/ASRouter.test.js index 7df1449a14..1f5899fce1 100644 --- a/browser/components/asrouter/tests/unit/ASRouter.test.js +++ b/browser/components/asrouter/tests/unit/ASRouter.test.js @@ -48,7 +48,6 @@ describe("ASRouter", () => { let fakeAttributionCode; let fakeTargetingContext; let FakeToolbarBadgeHub; - let FakeToolbarPanelHub; let FakeMomentsPageHub; let ASRouterTargeting; let screenImpressions; @@ -151,7 +150,6 @@ describe("ASRouter", () => { cfr: "", "message-groups": "", "messaging-experiments": "", - "whats-new-panel": "", }, totalBookmarksCount: {}, firefoxVersion: 80, @@ -159,7 +157,6 @@ describe("ASRouter", () => { needsUpdate: {}, hasPinnedTabs: false, hasAccessedFxAPanel: false, - isWhatsNewPanelEnabled: true, userPrefs: { cfrFeatures: true, cfrAddons: true, @@ -203,12 +200,6 @@ describe("ASRouter", () => { writeAttributionFile: () => Promise.resolve(), getCachedAttributionData: sinon.stub(), }; - FakeToolbarPanelHub = { - init: sandbox.stub(), - uninit: sandbox.stub(), - forceShowMessage: sandbox.stub(), - enableToolbarButton: sandbox.stub(), - }; FakeToolbarBadgeHub = { init: sandbox.stub(), uninit: sandbox.stub(), @@ -252,7 +243,6 @@ describe("ASRouter", () => { PanelTestProvider, MacAttribution: { applicationPath: "" }, ToolbarBadgeHub: FakeToolbarBadgeHub, - ToolbarPanelHub: FakeToolbarPanelHub, MomentsPageHub: FakeMomentsPageHub, KintoHttpClient: class { bucket() { @@ -354,7 +344,6 @@ describe("ASRouter", () => { // ASRouter init called in `beforeEach` block above assert.calledOnce(FakeToolbarBadgeHub.init); - assert.calledOnce(FakeToolbarPanelHub.init); assert.calledOnce(FakeMomentsPageHub.init); assert.calledWithExactly( @@ -370,15 +359,6 @@ describe("ASRouter", () => { ); assert.calledWithExactly( - FakeToolbarPanelHub.init, - Router.waitForInitialized, - { - getMessages: Router.handleMessageRequest, - sendTelemetry: Router.sendTelemetry, - } - ); - - assert.calledWithExactly( FakeMomentsPageHub.init, Router.waitForInitialized, { @@ -678,25 +658,10 @@ describe("ASRouter", () => { sandbox.stub(CFRPageActions, "addRecommendation"); browser = {}; }); - it("should route whatsnew_panel_message message to the right hub", () => { - Router.routeCFRMessage( - { template: "whatsnew_panel_message" }, - browser, - "", - true - ); - - assert.calledOnce(FakeToolbarPanelHub.forceShowMessage); - assert.notCalled(FakeToolbarBadgeHub.registerBadgeNotificationListener); - assert.notCalled(CFRPageActions.addRecommendation); - assert.notCalled(CFRPageActions.forceRecommendation); - assert.notCalled(FakeMomentsPageHub.executeAction); - }); it("should route moments messages to the right hub", () => { Router.routeCFRMessage({ template: "update_action" }, browser, "", true); assert.calledOnce(FakeMomentsPageHub.executeAction); - assert.notCalled(FakeToolbarPanelHub.forceShowMessage); assert.notCalled(FakeToolbarBadgeHub.registerBadgeNotificationListener); assert.notCalled(CFRPageActions.addRecommendation); assert.notCalled(CFRPageActions.forceRecommendation); @@ -705,7 +670,6 @@ describe("ASRouter", () => { Router.routeCFRMessage({ template: "toolbar_badge" }, browser); assert.calledOnce(FakeToolbarBadgeHub.registerBadgeNotificationListener); - assert.notCalled(FakeToolbarPanelHub.forceShowMessage); assert.notCalled(CFRPageActions.addRecommendation); assert.notCalled(CFRPageActions.forceRecommendation); assert.notCalled(FakeMomentsPageHub.executeAction); @@ -721,7 +685,6 @@ describe("ASRouter", () => { assert.calledOnce(CFRPageActions.addRecommendation); assert.notCalled(CFRPageActions.forceRecommendation); assert.notCalled(FakeToolbarBadgeHub.registerBadgeNotificationListener); - assert.notCalled(FakeToolbarPanelHub.forceShowMessage); assert.notCalled(FakeMomentsPageHub.executeAction); }); it("should route cfr_doorhanger message to the right hub force = false", () => { @@ -733,7 +696,6 @@ describe("ASRouter", () => { ); assert.calledOnce(CFRPageActions.addRecommendation); - assert.notCalled(FakeToolbarPanelHub.forceShowMessage); assert.notCalled(FakeToolbarBadgeHub.registerBadgeNotificationListener); assert.notCalled(CFRPageActions.forceRecommendation); assert.notCalled(FakeMomentsPageHub.executeAction); @@ -742,7 +704,6 @@ describe("ASRouter", () => { Router.routeCFRMessage({ template: "cfr_doorhanger" }, browser, {}, true); assert.calledOnce(CFRPageActions.forceRecommendation); - assert.notCalled(FakeToolbarPanelHub.forceShowMessage); assert.notCalled(CFRPageActions.addRecommendation); assert.notCalled(FakeToolbarBadgeHub.registerBadgeNotificationListener); assert.notCalled(FakeMomentsPageHub.executeAction); @@ -759,7 +720,6 @@ describe("ASRouter", () => { const { args } = CFRPageActions.addRecommendation.firstCall; // Host should be null assert.isNull(args[1]); - assert.notCalled(FakeToolbarPanelHub.forceShowMessage); assert.notCalled(FakeToolbarBadgeHub.registerBadgeNotificationListener); assert.notCalled(CFRPageActions.forceRecommendation); assert.notCalled(FakeMomentsPageHub.executeAction); @@ -773,7 +733,6 @@ describe("ASRouter", () => { ); assert.calledOnce(CFRPageActions.forceRecommendation); - assert.notCalled(FakeToolbarPanelHub.forceShowMessage); assert.notCalled(CFRPageActions.addRecommendation); assert.notCalled(FakeToolbarBadgeHub.registerBadgeNotificationListener); assert.notCalled(FakeMomentsPageHub.executeAction); @@ -786,7 +745,6 @@ describe("ASRouter", () => { true ); - assert.notCalled(FakeToolbarPanelHub.forceShowMessage); assert.notCalled(CFRPageActions.forceRecommendation); assert.notCalled(CFRPageActions.addRecommendation); assert.notCalled(FakeToolbarBadgeHub.registerBadgeNotificationListener); @@ -961,7 +919,6 @@ describe("ASRouter", () => { type: "local", enabled: true, messages: [ - "whatsnew_panel_message", "cfr_doorhanger", "toolbar_badge", "update_action", @@ -1272,43 +1229,6 @@ describe("ASRouter", () => { Router.state.messageImpressions ); }); - it("should return all unblocked messages that match the template, trigger if returnAll=true", async () => { - const message1 = { - provider: "whats_new", - id: "1", - template: "whatsnew_panel_message", - trigger: { id: "whatsNewPanelOpened" }, - groups: ["whats_new"], - }; - const message2 = { - provider: "whats_new", - id: "2", - template: "whatsnew_panel_message", - trigger: { id: "whatsNewPanelOpened" }, - groups: ["whats_new"], - }; - const message3 = { - provider: "whats_new", - id: "3", - template: "badge", - groups: ["whats_new"], - }; - ASRouterTargeting.findMatchingMessage.callsFake(() => [ - message2, - message1, - ]); - await Router.setState({ - messages: [message3, message2, message1], - providers: [{ id: "whats_new" }], - }); - const result = await Router.handleMessageRequest({ - template: "whatsnew_panel_message", - triggerId: "whatsNewPanelOpened", - returnAll: true, - }); - - assert.deepEqual(result, [message2, message1]); - }); it("should forward trigger param info", async () => { const trigger = { triggerId: "foo", @@ -1854,33 +1774,6 @@ describe("ASRouter", () => { }); }); - describe("#forceWNPanel", () => { - let browser = { - ownerGlobal: { - document: new Document(), - PanelUI: { - showSubView: sinon.stub(), - panel: { - setAttribute: sinon.stub(), - }, - }, - }, - }; - let fakePanel = { - setAttribute: sinon.stub(), - }; - sinon - .stub(browser.ownerGlobal.document, "getElementById") - .returns(fakePanel); - - it("should call enableToolbarButton", async () => { - await Router.forceWNPanel(browser); - assert.calledOnce(FakeToolbarPanelHub.enableToolbarButton); - assert.calledOnce(browser.ownerGlobal.PanelUI.showSubView); - assert.calledWith(fakePanel.setAttribute, "noautohide", true); - }); - }); - describe("_triggerHandler", () => { it("should call #sendTriggerMessage with the correct trigger", () => { const getter = sandbox.stub(); |