Move ToastContext and utilities to shared components (#33949)

* Move ToastContext and utilities to shared components

* lint

* fix type

* cleanup

* fix broken test

* fix lint

* Add more tests for ToastContext

* Potential fix for pull request finding 'Unused variable, import, function or class'

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

---------

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
This commit is contained in:
Will Hunt
2026-06-29 18:50:36 +00:00
committed by GitHub
co-authored by Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
parent 6ce24e2668
commit 0ddc418cf9
8 changed files with 89 additions and 49 deletions
@@ -12,6 +12,7 @@ import { type MatrixClient, ThreepidMedium } from "matrix-js-sdk/src/matrix";
import { logger } from "matrix-js-sdk/src/logger";
import userEvent from "@testing-library/user-event";
import { type MockedObject } from "jest-mock-vitest-adapter";
import { ToastContext, ToastRack } from "@element-hq/web-shared-components";
import AccountUserSettingsTab from "../../../../../../../src/components/views/settings/tabs/user/AccountUserSettingsTab";
import { SdkContextClass, SDKContext } from "../../../../../../../src/contexts/SDKContext";
@@ -54,7 +55,9 @@ describe("<AccountUserSettingsTab />", () => {
const getComponent = () => (
<MatrixClientContext.Provider value={mockClient}>
<SDKContext.Provider value={stores}>
<AccountUserSettingsTab {...defaultProps} />
<ToastContext.Provider value={new ToastRack()}>
<AccountUserSettingsTab {...defaultProps} />
</ToastContext.Provider>
</SDKContext.Provider>
</MatrixClientContext.Provider>
);