You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-08-07 21:23:00 +03:00
tests
This commit is contained in:
@@ -55,6 +55,28 @@ describe("PreferencesUserSettingsTab", () => {
|
|||||||
expect(reloadStub).toHaveBeenCalled();
|
expect(reloadStub).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should not show spell check setting if unsupported", async () => {
|
||||||
|
PlatformPeg.get()!.supportsSpellCheckSettings = jest.fn().mockReturnValue(false);
|
||||||
|
|
||||||
|
renderTab();
|
||||||
|
expect(screen.queryByRole("switch", { name: "Allow spell check" })).not.toBeInTheDocument();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should enable spell check", async () => {
|
||||||
|
const spellCheckEnableFn = jest.fn();
|
||||||
|
PlatformPeg.get()!.supportsSpellCheckSettings = jest.fn().mockReturnValue(true);
|
||||||
|
PlatformPeg.get()!.getSpellCheckEnabled = jest.fn().mockReturnValue(false);
|
||||||
|
PlatformPeg.get()!.setSpellCheckEnabled = spellCheckEnableFn;
|
||||||
|
|
||||||
|
renderTab();
|
||||||
|
const toggle = await screen.findByRole("switch", { name: "Allow spell check" });
|
||||||
|
expect(toggle).toHaveAttribute("aria-checked", "false");
|
||||||
|
|
||||||
|
await userEvent.click(toggle);
|
||||||
|
|
||||||
|
expect(spellCheckEnableFn).toHaveBeenCalledWith(true);
|
||||||
|
});
|
||||||
|
|
||||||
describe("send read receipts", () => {
|
describe("send read receipts", () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
stubClient();
|
stubClient();
|
||||||
|
Reference in New Issue
Block a user