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
8 changes: 4 additions & 4 deletions packages/react/src/auth/forms/sign-in-auth-form.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ describe("<SignInAuthForm />", () => {
expect(onForgotPasswordClickMock).toHaveBeenCalled();
});

it("should render the register button callback when onRegisterClick is provided", () => {
it("should render the register button callback when onSignUpClick is provided", () => {
const mockUI = createMockUI({
locale: registerLocale("test", {
prompts: {
Expand All @@ -241,11 +241,11 @@ describe("<SignInAuthForm />", () => {
}),
});

const onRegisterClickMock = vi.fn();
const onSignUpClick = vi.fn();

render(
<FirebaseUIProvider ui={mockUI}>
<SignInAuthForm onRegisterClick={onRegisterClickMock} />
<SignInAuthForm onSignUpClick={onSignUpClick} />
</FirebaseUIProvider>
);

Expand All @@ -259,7 +259,7 @@ describe("<SignInAuthForm />", () => {
expect(registerButton).toHaveAttribute("type", "button");

fireEvent.click(registerButton);
expect(onRegisterClickMock).toHaveBeenCalled();
expect(onSignUpClick).toHaveBeenCalled();
});

it("should trigger validation errors when the form is blurred", () => {
Expand Down
8 changes: 4 additions & 4 deletions packages/react/src/auth/forms/sign-in-auth-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { useCallback } from "react";
export type SignInAuthFormProps = {
onSignIn?: (credential: UserCredential) => void;
onForgotPasswordClick?: () => void;
onRegisterClick?: () => void;
onSignUpClick?: () => void;
};

export function useSignInAuthFormAction() {
Expand Down Expand Up @@ -73,7 +73,7 @@ export function useSignInAuthForm(onSuccess?: SignInAuthFormProps["onSignIn"]) {
});
}

export function SignInAuthForm({ onSignIn, onForgotPasswordClick, onRegisterClick }: SignInAuthFormProps) {
export function SignInAuthForm({ onSignIn, onForgotPasswordClick, onSignUpClick }: SignInAuthFormProps) {
const ui = useUI();
const form = useSignInAuthForm(onSignIn);

Expand Down Expand Up @@ -110,8 +110,8 @@ export function SignInAuthForm({ onSignIn, onForgotPasswordClick, onRegisterClic
<form.SubmitButton>{getTranslation(ui, "labels", "signIn")}</form.SubmitButton>
<form.ErrorMessage />
</fieldset>
{onRegisterClick ? (
<form.Action onClick={onRegisterClick}>
{onSignUpClick ? (
<form.Action onClick={onSignUpClick}>
{getTranslation(ui, "prompts", "noAccount")} {getTranslation(ui, "labels", "signUp")}
</form.Action>
) : null}
Expand Down
8 changes: 4 additions & 4 deletions packages/shadcn/src/registry/sign-in-auth-form.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ describe("<SignInAuthForm />", () => {
expect(onForgotPasswordClickMock).toHaveBeenCalled();
});

it("should render with register callback", () => {
const onRegisterClickMock = vi.fn();
it("should render with onSignUp callback", () => {
const onSignUpClickMock = vi.fn();
const mockUI = createMockUI({
locale: registerLocale("test", {
prompts: {
Expand All @@ -111,7 +111,7 @@ describe("<SignInAuthForm />", () => {

const { container } = render(
<FirebaseUIProvider ui={mockUI}>
<SignInAuthForm onRegisterClick={onRegisterClickMock} />
<SignInAuthForm onSignUpClick={onSignUpClickMock} />
</FirebaseUIProvider>
);

Expand All @@ -123,7 +123,7 @@ describe("<SignInAuthForm />", () => {
fireEvent.click(button!);
});

expect(onRegisterClickMock).toHaveBeenCalled();
expect(onSignUpClickMock).toHaveBeenCalled();
});

it("should call the onSignIn callback when the form is submitted", async () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/shadcn/src/registry/sign-in-auth-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ export function SignInAuthForm(props: SignInAuthFormProps) {
{getTranslation(ui, "labels", "signIn")}
</Button>
{form.formState.errors.root && <FormMessage>{form.formState.errors.root.message}</FormMessage>}
{props.onRegisterClick ? (
{props.onSignUpClick ? (
<>
<Button type="button" variant="secondary" onClick={props.onRegisterClick}>
<Button type="button" variant="secondary" onClick={props.onSignUpClick}>
{getTranslation(ui, "prompts", "noAccount")} {getTranslation(ui, "labels", "signUp")}
</Button>
</>
Expand Down
Loading