Skip to content

Commit 96281c4

Browse files
committed
Merge branch '@invertase/v7-development' of https://github.com/firebase/firebaseui-web into @invertase/bb-7
2 parents 16c34e3 + ee1569b commit 96281c4

25 files changed

+218
-95
lines changed

examples/shadcn/src/components/sign-in-auth-form.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export function SignInAuthForm(props: SignInAuthFormProps) {
8080
{props.onRegisterClick ? (
8181
<>
8282
<Button type="button" variant="secondary" onClick={props.onRegisterClick}>
83-
{getTranslation(ui, "prompts", "noAccount")} {getTranslation(ui, "labels", "register")}
83+
{getTranslation(ui, "prompts", "noAccount")} {getTranslation(ui, "labels", "signUp")}
8484
</Button>
8585
</>
8686
) : null}

examples/shadcn/src/components/sign-up-auth-screen.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export type { SignUpAuthScreenProps };
1212
export function SignUpAuthScreen({ children, ...props }: SignUpAuthScreenProps) {
1313
const ui = useUI();
1414

15-
const titleText = getTranslation(ui, "labels", "register");
15+
const titleText = getTranslation(ui, "labels", "signUp");
1616
const subtitleText = getTranslation(ui, "prompts", "enterDetailsToCreate");
1717

1818
return (

packages/angular/src/lib/auth/forms/sign-in-auth-form.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ describe("<fui-sign-in-auth-form />", () => {
7878
expect(screen.getByRole("button", { name: "Sign In" })).toBeInTheDocument();
7979
expect(screen.getByText("By continuing, you agree to our")).toBeInTheDocument();
8080
expect(screen.getByRole("button", { name: "Forgot Password" })).toBeInTheDocument();
81-
expect(screen.getByRole("button", { name: "Don't have an account? Register" })).toBeInTheDocument();
81+
expect(screen.getByRole("button", { name: "Don't have an account? Sign Up" })).toBeInTheDocument();
8282
});
8383

8484
it("should have correct translation labels", async () => {
@@ -102,7 +102,7 @@ describe("<fui-sign-in-auth-form />", () => {
102102
expect(component.forgotPasswordLabel()).toBe("Forgot Password");
103103
expect(component.signInLabel()).toBe("Sign In");
104104
expect(component.noAccountLabel()).toBe("Don't have an account?");
105-
expect(component.registerLabel()).toBe("Register");
105+
expect(component.signUpLabel()).toBe("Sign Up");
106106
expect(component.unknownErrorLabel()).toBe("An unknown error occurred");
107107
});
108108

@@ -164,7 +164,7 @@ describe("<fui-sign-in-auth-form />", () => {
164164
const component = fixture.componentInstance;
165165
const signUpSpy = jest.spyOn(component.signUp, "emit");
166166

167-
const signUpButton = screen.getByRole("button", { name: "Don't have an account? Register" });
167+
const signUpButton = screen.getByRole("button", { name: "Don't have an account? Sign Up" });
168168
fireEvent.click(signUpButton);
169169
expect(signUpSpy).toHaveBeenCalled();
170170
});

packages/angular/src/lib/auth/forms/sign-in-auth-form.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,13 @@ import {
5353
></fui-form-input>
5454
</fieldset>
5555
<fieldset>
56-
<fui-form-input name="password" tanstack-app-field [tanstackField]="form" label="{{ passwordLabel() }}">
56+
<fui-form-input
57+
name="password"
58+
tanstack-app-field
59+
[tanstackField]="form"
60+
label="{{ passwordLabel() }}"
61+
type="password"
62+
>
5763
@if (forgotPassword) {
5864
<button ngProjectAs="input-action" fui-form-action (click)="forgotPassword.emit()">
5965
{{ forgotPasswordLabel() }}
@@ -72,7 +78,7 @@ import {
7278
</fieldset>
7379
7480
@if (signUp) {
75-
<button fui-form-action (click)="signUp.emit()">{{ noAccountLabel() }} {{ registerLabel() }}</button>
81+
<button fui-form-action (click)="signUp.emit()">{{ noAccountLabel() }} {{ signUpLabel() }}</button>
7682
}
7783
</form>
7884
`,
@@ -86,7 +92,7 @@ export class SignInAuthFormComponent {
8692
forgotPasswordLabel = injectTranslation("labels", "forgotPassword");
8793
signInLabel = injectTranslation("labels", "signIn");
8894
noAccountLabel = injectTranslation("prompts", "noAccount");
89-
registerLabel = injectTranslation("labels", "register");
95+
signUpLabel = injectTranslation("labels", "signUp");
9096
unknownErrorLabel = injectTranslation("errors", "unknownError");
9197

9298
forgotPassword = output<void>();

packages/angular/src/lib/auth/forms/sign-up-auth-form.ts

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -43,35 +43,29 @@ import {
4343
],
4444
template: `
4545
<form (submit)="handleSubmit($event)" class="fui-form">
46-
<fieldset>
47-
<fui-form-input
48-
name="email"
49-
tanstack-app-field
50-
[tanstackField]="form"
51-
label="{{ emailLabel() }}"
52-
></fui-form-input>
53-
</fieldset>
54-
<fieldset>
55-
<fui-form-input
56-
name="password"
57-
tanstack-app-field
58-
[tanstackField]="form"
59-
label="{{ passwordLabel() }}"
60-
></fui-form-input>
61-
</fieldset>
6246
@if (requireDisplayNameField()) {
6347
<fieldset>
6448
<fui-form-input
6549
name="displayName"
6650
tanstack-app-field
6751
[tanstackField]="form"
6852
label="{{ displayNameLabel() }}"
69-
></fui-form-input>
53+
/>
7054
</fieldset>
7155
}
72-
56+
<fieldset>
57+
<fui-form-input name="email" tanstack-app-field [tanstackField]="form" label="{{ emailLabel() }}" />
58+
</fieldset>
59+
<fieldset>
60+
<fui-form-input
61+
name="password"
62+
tanstack-app-field
63+
[tanstackField]="form"
64+
label="{{ passwordLabel() }}"
65+
type="password"
66+
/>
67+
</fieldset>
7368
<fui-policies />
74-
7569
<fieldset>
7670
<fui-form-submit [state]="state()">
7771
{{ createAccountLabel() }}

packages/angular/src/lib/auth/screens/sign-up-auth-screen.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ describe("<fui-sign-up-auth-screen>", () => {
7373
injectTranslation.mockImplementation((category: string, key: string) => {
7474
const mockTranslations: Record<string, Record<string, string>> = {
7575
labels: {
76-
register: "Create Account",
76+
signUp: "Create Account",
7777
},
7878
prompts: {
7979
enterDetailsToCreate: "Enter your details to create an account",
@@ -205,7 +205,7 @@ describe("<fui-sign-up-auth-screen>", () => {
205205
],
206206
});
207207

208-
expect(injectTranslation).toHaveBeenCalledWith("labels", "register");
208+
expect(injectTranslation).toHaveBeenCalledWith("labels", "signUp");
209209
expect(injectTranslation).toHaveBeenCalledWith("prompts", "enterDetailsToCreate");
210210
});
211211

packages/angular/src/lib/auth/screens/sign-up-auth-screen.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export class SignUpAuthScreenComponent {
6969

7070
mfaResolver = computed(() => this.ui().multiFactorResolver);
7171

72-
titleText = injectTranslation("labels", "register");
72+
titleText = injectTranslation("labels", "signUp");
7373
subtitleText = injectTranslation("prompts", "enterDetailsToCreate");
7474

7575
signUp = output<UserCredential>();

packages/angular/src/lib/components/form.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ export class FormMetadataComponent {
4343
[value]="field.api.state.value"
4444
(blur)="field.api.handleBlur()"
4545
(input)="field.api.handleChange($any($event).target.value)"
46+
[type]="type()"
4647
/>
4748
</div>
4849
<ng-content></ng-content>
@@ -53,6 +54,7 @@ export class FormMetadataComponent {
5354
export class FormInputComponent {
5455
field = injectField<string>();
5556
label = input.required<string>();
57+
type = input<string>("text");
5658
}
5759

5860
@Component({
@@ -102,9 +104,12 @@ export class FormErrorMessageComponent {
102104

103105
errorMessage = computed(() => {
104106
const error = this.state().errorMap?.onSubmit;
105-
if (!error) return undefined;
106107

107-
// Handle string errors
108-
return String(error);
108+
// We only care about errors thrown from the form submission, rather than validation errors
109+
if (error && typeof error === "string") {
110+
return error;
111+
}
112+
113+
return undefined;
109114
});
110115
}

packages/angular/src/lib/tests/test-helpers.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ export const injectUI = jest.fn().mockReturnValue(() => ({
7575
sendSignInLink: "Send Sign In Link",
7676
resetPassword: "Reset Password",
7777
backToSignIn: "Back to Sign In",
78-
register: "Register",
7978
termsOfService: "Terms of Service",
8079
privacyPolicy: "Privacy Policy",
8180
},
@@ -109,7 +108,6 @@ export const injectTranslation = jest.fn().mockImplementation((category: string,
109108
sendSignInLink: "Send Sign In Link",
110109
resetPassword: "Reset Password",
111110
backToSignIn: "Back to Sign In",
112-
register: "Register",
113111
termsOfService: "Terms of Service",
114112
privacyPolicy: "Privacy Policy",
115113
phoneNumber: "Phone Number",

packages/react/src/auth/forms/sign-in-auth-form.test.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ describe("<SignInAuthForm />", () => {
193193

194194
// Make sure we have an email and password input
195195
expect(screen.getByRole("textbox", { name: /email/i })).toBeInTheDocument();
196-
expect(screen.getByRole("textbox", { name: /password/i })).toBeInTheDocument();
196+
expect(screen.getByLabelText(/password/i)).toBeInTheDocument();
197197

198198
// Ensure the "Sign In" button is present and is a submit button
199199
const signInButton = screen.getByRole("button", { name: "signIn" });
@@ -229,23 +229,23 @@ describe("<SignInAuthForm />", () => {
229229
expect(onForgotPasswordClickMock).toHaveBeenCalled();
230230
});
231231

232-
it("should render the register button callback when onRegisterClick is provided", () => {
232+
it("should render the register button callback when onSignUpClick is provided", () => {
233233
const mockUI = createMockUI({
234234
locale: registerLocale("test", {
235235
prompts: {
236236
noAccount: "foo",
237237
},
238238
labels: {
239-
register: "bar",
239+
signUp: "bar",
240240
},
241241
}),
242242
});
243243

244-
const onRegisterClickMock = vi.fn();
244+
const onSignUpClick = vi.fn();
245245

246246
render(
247247
<FirebaseUIProvider ui={mockUI}>
248-
<SignInAuthForm onRegisterClick={onRegisterClickMock} />
248+
<SignInAuthForm onSignUpClick={onSignUpClick} />
249249
</FirebaseUIProvider>
250250
);
251251

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

261261
fireEvent.click(registerButton);
262-
expect(onRegisterClickMock).toHaveBeenCalled();
262+
expect(onSignUpClick).toHaveBeenCalled();
263263
});
264264

265265
it("should trigger validation errors when the form is blurred", () => {

0 commit comments

Comments
 (0)