1
0
mirror of https://github.com/element-hq/element-web.git synced 2025-08-08 03:42:14 +03:00

Fix share button in discovery settings being disabled incorrectly (#29151)

* Fix share button in discovery settings being disabled incorrectly

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Improve types & add tests

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Iterate

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Iterate

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Improve coverage

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Add missing snapshot

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

---------

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski
2025-02-03 08:48:02 +00:00
committed by GitHub
parent aa01b17f9e
commit 4f1eac67a8
13 changed files with 332 additions and 94 deletions

View File

@@ -10,10 +10,12 @@ import React from "react";
import { render, screen, waitFor, act, fireEvent } from "jest-matrix-react";
import { AuthType } from "matrix-js-sdk/src/interactive-auth";
import userEvent from "@testing-library/user-event";
import { Policy } from "matrix-js-sdk/src/matrix";
import {
EmailIdentityAuthEntry,
MasUnlockCrossSigningAuthEntry,
TermsAuthEntry,
} from "../../../../../src/components/views/auth/InteractiveAuthEntryComponents";
import { createTestClient } from "../../../../test-utils";
@@ -99,3 +101,38 @@ describe("<MasUnlockCrossSigningAuthEntry/>", () => {
expect(submitAuthDict).toHaveBeenCalledWith({});
});
});
describe("<TermsAuthEntry/>", () => {
const renderAuth = (policy: Policy, props = {}) => {
const matrixClient = createTestClient();
return render(
<TermsAuthEntry
matrixClient={matrixClient}
loginType={AuthType.Email}
onPhaseChange={jest.fn()}
submitAuthDict={jest.fn()}
fail={jest.fn()}
clientSecret="my secret"
showContinue={true}
stageParams={{
policies: {
test_policy: policy,
},
}}
{...props}
/>,
);
};
test("should render", () => {
const { container } = renderAuth({
version: "alpha",
en: {
name: "Test Policy",
url: "https://example.com/en",
},
});
expect(container).toMatchSnapshot();
});
});