Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { FormAuth } from "./authentication";

describe("FormAuth form signup toggle", () => {
it("has a label that does not change with the toggle state", () => {
const signupSetting = FormAuth.settings?.find(
(setting) => setting.id === "isSignupDisabled",
);

expect(signupSetting).toBeDefined();
// The toggle text must describe what the setting does, not the current
// state — a state-dependent label reads as the option itself changing.
expect(signupSetting?.toggleText?.(true)).toEqual(
signupSetting?.toggleText?.(false),
);
// Pin the wording: the label must describe the ON state (open signup).
// A static "invited only" label would invert the meaning of the switch.
expect(signupSetting?.toggleText?.(false)).toEqual(
"Allow all users to signup",
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,7 @@ export const FormAuth: AdminConfigType = {
category: SettingCategories.FORM_AUTH,
controlType: SettingTypes.TOGGLE,
label: "Form signup",
toggleText: (value: boolean) =>
value
? "Allow only invited users to signup"
: "Allow all users to signup",
toggleText: () => "Allow all users to signup",
},
{
id: "emailVerificationEnabled",
Expand Down
Loading