Don't show release announcements while toasts are displayed (#30770)

* Don't show release announcements while toasts are displayed

Otherwise they can clash and look like a mess.

* Dismiss the toast in the e2e test

* Update screenshot
This commit is contained in:
David Baker
2025-09-16 12:37:10 +01:00
committed by GitHub
parent 4dc087c342
commit ccf0762737
4 changed files with 23 additions and 0 deletions

View File

@@ -11,8 +11,10 @@ import { mocked } from "jest-mock";
import SettingsStore, { type CallbackFn } from "../../../src/settings/SettingsStore";
import { type Feature, ReleaseAnnouncementStore } from "../../../src/stores/ReleaseAnnouncementStore";
import { type SettingLevel } from "../../../src/settings/SettingLevel";
import ToastStore from "../../../src/stores/ToastStore";
jest.mock("../../../src/settings/SettingsStore");
jest.mock("../../../src/stores/ToastStore");
describe("ReleaseAnnouncementStore", () => {
let releaseAnnouncementStore: ReleaseAnnouncementStore;
@@ -48,6 +50,11 @@ describe("ReleaseAnnouncementStore", () => {
return "watcherId";
});
mocked(ToastStore.sharedInstance).mockReturnValue({
on: jest.fn(),
getToasts: jest.fn().mockReturnValue([]),
} as any);
releaseAnnouncementStore = new ReleaseAnnouncementStore();
});
@@ -118,4 +125,10 @@ describe("ReleaseAnnouncementStore", () => {
expect(await promise).toBe("newRoomList_sort");
expect(releaseAnnouncementStore.getReleaseAnnouncement()).toBe("newRoomList_sort");
});
it("should return null when there are toasts on screen", async () => {
mocked(ToastStore.sharedInstance().getToasts).mockReturnValue([{} as any]);
expect(releaseAnnouncementStore.getReleaseAnnouncement()).toBeNull();
});
});