2024-11-05 15:41:00 +00:00
|
|
|
/*
|
|
|
|
|
Copyright 2024 New Vector Ltd.
|
|
|
|
|
Copyright 2022 The Matrix.org Foundation C.I.C.
|
|
|
|
|
|
2025-01-06 11:18:54 +00:00
|
|
|
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
|
2024-11-05 15:41:00 +00:00
|
|
|
Please see LICENSE files in the repository root for full details.
|
|
|
|
|
*/
|
|
|
|
|
|
2025-03-19 10:39:52 +00:00
|
|
|
import React from "react";
|
2024-11-05 15:41:00 +00:00
|
|
|
import { render } from "jest-matrix-react";
|
|
|
|
|
|
|
|
|
|
import AuthPage from "../../../../../src/components/views/auth/AuthPage";
|
|
|
|
|
import { setupLanguageMock } from "../../../../setup/setupLanguage";
|
|
|
|
|
import SdkConfig from "../../../../../src/SdkConfig.ts";
|
|
|
|
|
|
|
|
|
|
describe("<AuthPage />", () => {
|
|
|
|
|
beforeEach(() => {
|
|
|
|
|
setupLanguageMock();
|
|
|
|
|
SdkConfig.reset();
|
|
|
|
|
// @ts-ignore private access
|
|
|
|
|
AuthPage.welcomeBackgroundUrl = undefined;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it("should match snapshot", () => {
|
|
|
|
|
const { asFragment } = render(<AuthPage />);
|
|
|
|
|
expect(asFragment()).toMatchSnapshot();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it("should use configured background url", () => {
|
|
|
|
|
SdkConfig.add({ branding: { welcome_background_url: ["https://example.com/image.png"] } });
|
|
|
|
|
const { container } = render(<AuthPage />);
|
|
|
|
|
expect(container.querySelector(".mx_AuthPage")).toHaveStyle({
|
|
|
|
|
background: "center/cover fixed url(https://example.com/image.png)",
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|