feat: complete phase 2 UX improvements
CI and Deploy / test (push) Successful in 2m42s
CI and Deploy / deploy (push) Failing after 9s

This commit is contained in:
cesnimda
2026-07-30 21:35:52 +02:00
parent 173187dcbb
commit 56fed05d70
26 changed files with 1979 additions and 12283 deletions
+15 -2
View File
@@ -20,12 +20,12 @@ const mockedApi = api as jest.Mocked<typeof api>;
let consoleErrorSpy: jest.SpyInstance;
function renderLoginPage() {
function renderLoginPage(initialMode: "login" | "register" = "login") {
return render(
<MemoryRouter future={{ v7_startTransition: true, v7_relativeSplatPath: true }}>
<I18nProvider>
<ToastProvider>
<LoginPage />
<LoginPage initialMode={initialMode} />
</ToastProvider>
</I18nProvider>
</MemoryRouter>,
@@ -33,6 +33,19 @@ function renderLoginPage() {
}
describe('LoginPage', () => {
it('renders a dedicated registration screen and explains when registration is disabled', async () => {
mockedApi.get.mockResolvedValueOnce({
data: { requireAuth: true, googleEnabled: false, microsoftEnabled: false, localEnabled: true, allowRegistration: false, requireEmailVerification: true },
} as any);
renderLoginPage("register");
expect(await screen.findByText('Registration is currently unavailable.')).toBeInTheDocument();
expect(screen.getByRole('heading', { name: 'Create account' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: 'Create account' })).toBeDisabled();
expect(screen.queryByRole('tab')).not.toBeInTheDocument();
});
beforeEach(() => {
const originalConsoleError = console.error.bind(console);
consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation((...args: unknown[]) => {