diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:42 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:42 +0000 |
commit | da4c7e7ed675c3bf405668739c3012d140856109 (patch) | |
tree | cdd868dba063fecba609a1d819de271f0d51b23e /browser/components/asrouter/tests/unit/ASRouter.test.js | |
parent | Adding upstream version 125.0.3. (diff) | |
download | firefox-da4c7e7ed675c3bf405668739c3012d140856109.tar.xz firefox-da4c7e7ed675c3bf405668739c3012d140856109.zip |
Adding upstream version 126.0.upstream/126.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/components/asrouter/tests/unit/ASRouter.test.js')
-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(); |