Add mechanism for Electron to render toasts (#30765)
* Add mechanism for Electron to render toasts Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Tests Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
committed by
GitHub
parent
0747c9f0e8
commit
eaa20a2c9a
@@ -21,6 +21,7 @@ import DesktopCapturerSourcePicker from "../../../../src/components/views/elemen
|
||||
import ElectronPlatform from "../../../../src/vector/platform/ElectronPlatform";
|
||||
import { setupLanguageMock } from "../../../setup/setupLanguage";
|
||||
import { stubClient } from "../../../test-utils";
|
||||
import ToastStore from "../../../../src/stores/ToastStore.ts";
|
||||
|
||||
jest.mock("../../../../src/rageshake/rageshake", () => ({
|
||||
flush: jest.fn(),
|
||||
@@ -127,6 +128,19 @@ describe("ElectronPlatform", () => {
|
||||
expect(plat.ipc.call).toHaveBeenCalledWith("callDisplayMediaCallback", "source");
|
||||
});
|
||||
|
||||
it("should show a toast when showToast is fired", async () => {
|
||||
new ElectronPlatform();
|
||||
const spy = jest.spyOn(ToastStore.sharedInstance(), "addOrReplaceToast");
|
||||
|
||||
const [event, handler] = getElectronEventHandlerCall("showToast")!;
|
||||
handler({} as any, { title: "title", description: "description" });
|
||||
|
||||
expect(event).toBeTruthy();
|
||||
expect(spy).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ title: "title", props: expect.objectContaining({ description: "description" }) }),
|
||||
);
|
||||
});
|
||||
|
||||
describe("updates", () => {
|
||||
it("dispatches on check updates action", () => {
|
||||
new ElectronPlatform();
|
||||
|
||||
Reference in New Issue
Block a user