Skip to content

Commit c36a352

Browse files
authored
Merge pull request #1265 from firebase/@invertase/oauth-signin
2 parents 0bad2dd + 436fd62 commit c36a352

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+753
-116
lines changed

packages/angular/src/lib/auth/oauth/apple-sign-in-button.spec.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,16 @@ describe("<fui-apple-sign-in-button>", () => {
9393
const button = screen.getByRole("button");
9494
expect(button).toHaveAttribute("data-provider", "apple.com");
9595
});
96+
97+
it("has signIn output", async () => {
98+
const { fixture } = await render(TestAppleSignInButtonHostComponent);
99+
100+
const component = fixture.componentInstance;
101+
expect(component).toBeTruthy();
102+
// Verify the component has the signIn output
103+
const buttonComponent = fixture.debugElement.query(
104+
(el) => el.name === "fui-apple-sign-in-button"
105+
)?.componentInstance;
106+
expect(buttonComponent?.signIn).toBeDefined();
107+
});
96108
});

packages/angular/src/lib/auth/oauth/apple-sign-in-button.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { Component, input } from "@angular/core";
17+
import { Component, input, output } from "@angular/core";
1818
import { CommonModule } from "@angular/common";
1919
import { OAuthButtonComponent } from "./oauth-button";
2020
import { injectTranslation, injectUI } from "../../provider";
21-
import { OAuthProvider } from "@angular/fire/auth";
21+
import { OAuthProvider, UserCredential } from "@angular/fire/auth";
2222
import { AppleLogoComponent } from "../../components/logos/apple";
2323

2424
@Component({
@@ -29,7 +29,7 @@ import { AppleLogoComponent } from "../../components/logos/apple";
2929
style: "display: block;",
3030
},
3131
template: `
32-
<fui-oauth-button [provider]="appleProvider" [themed]="themed()">
32+
<fui-oauth-button [provider]="appleProvider" [themed]="themed()" (signIn)="signIn.emit($event)">
3333
<fui-apple-logo />
3434
<span>{{ signInWithAppleLabel() }}</span>
3535
</fui-oauth-button>
@@ -39,6 +39,7 @@ export class AppleSignInButtonComponent {
3939
ui = injectUI();
4040
signInWithAppleLabel = injectTranslation("labels", "signInWithApple");
4141
themed = input<boolean>(false);
42+
signIn = output<UserCredential>();
4243

4344
private defaultProvider = new OAuthProvider("apple.com");
4445

packages/angular/src/lib/auth/oauth/facebook-sign-in-button.spec.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,16 @@ describe("<fui-facebook-sign-in-button>", () => {
9393
const button = screen.getByRole("button");
9494
expect(button).toHaveAttribute("data-provider", "facebook.com");
9595
});
96+
97+
it("has signIn output", async () => {
98+
const { fixture } = await render(TestFacebookSignInButtonHostComponent);
99+
100+
const component = fixture.componentInstance;
101+
expect(component).toBeTruthy();
102+
// Verify the component has the signIn output
103+
const buttonComponent = fixture.debugElement.query(
104+
(el) => el.name === "fui-facebook-sign-in-button"
105+
)?.componentInstance;
106+
expect(buttonComponent?.signIn).toBeDefined();
107+
});
96108
});

packages/angular/src/lib/auth/oauth/facebook-sign-in-button.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { Component, input } from "@angular/core";
17+
import { Component, input, output } from "@angular/core";
1818
import { CommonModule } from "@angular/common";
19-
import { FacebookAuthProvider } from "@angular/fire/auth";
19+
import { FacebookAuthProvider, UserCredential } from "@angular/fire/auth";
2020
import { OAuthButtonComponent } from "./oauth-button";
2121
import { injectTranslation, injectUI } from "../../provider";
2222
import { FacebookLogoComponent } from "../../components/logos/facebook";
@@ -29,7 +29,7 @@ import { FacebookLogoComponent } from "../../components/logos/facebook";
2929
style: "display: block;",
3030
},
3131
template: `
32-
<fui-oauth-button [provider]="facebookProvider" [themed]="themed()">
32+
<fui-oauth-button [provider]="facebookProvider" [themed]="themed()" (signIn)="signIn.emit($event)">
3333
<fui-facebook-logo />
3434
<span>{{ signInWithFacebookLabel() }}</span>
3535
</fui-oauth-button>
@@ -39,6 +39,7 @@ export class FacebookSignInButtonComponent {
3939
ui = injectUI();
4040
signInWithFacebookLabel = injectTranslation("labels", "signInWithFacebook");
4141
themed = input<boolean>(false);
42+
signIn = output<UserCredential>();
4243

4344
private defaultProvider = new FacebookAuthProvider();
4445

packages/angular/src/lib/auth/oauth/github-sign-in-button.spec.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,16 @@ describe("<fui-github-sign-in-button>", () => {
9393
const button = screen.getByRole("button");
9494
expect(button).toHaveAttribute("data-provider", "github.com");
9595
});
96+
97+
it("has signIn output", async () => {
98+
const { fixture } = await render(TestGithubSignInButtonHostComponent);
99+
100+
const component = fixture.componentInstance;
101+
expect(component).toBeTruthy();
102+
// Verify the component has the signIn output
103+
const buttonComponent = fixture.debugElement.query(
104+
(el) => el.name === "fui-github-sign-in-button"
105+
)?.componentInstance;
106+
expect(buttonComponent?.signIn).toBeDefined();
107+
});
96108
});

packages/angular/src/lib/auth/oauth/github-sign-in-button.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { Component, input } from "@angular/core";
17+
import { Component, input, output } from "@angular/core";
1818
import { CommonModule } from "@angular/common";
1919
import { OAuthButtonComponent } from "./oauth-button";
2020
import { injectTranslation } from "../../provider";
21-
import { GithubAuthProvider } from "@angular/fire/auth";
21+
import { GithubAuthProvider, UserCredential } from "@angular/fire/auth";
2222
import { GithubLogoComponent } from "../../components/logos/github";
2323

2424
@Component({
@@ -29,7 +29,7 @@ import { GithubLogoComponent } from "../../components/logos/github";
2929
style: "display: block;",
3030
},
3131
template: `
32-
<fui-oauth-button [provider]="githubProvider" [themed]="themed()">
32+
<fui-oauth-button [provider]="githubProvider" [themed]="themed()" (signIn)="signIn.emit($event)">
3333
<fui-github-logo />
3434
<span>{{ signInWithGitHubLabel() }}</span>
3535
</fui-oauth-button>
@@ -38,6 +38,7 @@ import { GithubLogoComponent } from "../../components/logos/github";
3838
export class GitHubSignInButtonComponent {
3939
signInWithGitHubLabel = injectTranslation("labels", "signInWithGitHub");
4040
themed = input<boolean>(false);
41+
signIn = output<UserCredential>();
4142

4243
private defaultProvider = new GithubAuthProvider();
4344

packages/angular/src/lib/auth/oauth/google-sign-in-button.spec.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,16 @@ describe("<fui-google-sign-in-button>", () => {
9393
const button = screen.getByRole("button");
9494
expect(button).toHaveAttribute("data-provider", "google.com");
9595
});
96+
97+
it("has signIn output", async () => {
98+
const { fixture } = await render(TestGoogleSignInButtonHostComponent);
99+
100+
const component = fixture.componentInstance;
101+
expect(component).toBeTruthy();
102+
// Verify the component has the signIn output
103+
const buttonComponent = fixture.debugElement.query(
104+
(el) => el.name === "fui-google-sign-in-button"
105+
)?.componentInstance;
106+
expect(buttonComponent?.signIn).toBeDefined();
107+
});
96108
});

packages/angular/src/lib/auth/oauth/google-sign-in-button.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { Component, input } from "@angular/core";
17+
import { Component, input, output } from "@angular/core";
1818
import { CommonModule } from "@angular/common";
19-
import { GoogleAuthProvider } from "@angular/fire/auth";
19+
import { GoogleAuthProvider, UserCredential } from "@angular/fire/auth";
2020
import { injectTranslation, injectUI } from "../../provider";
2121
import { OAuthButtonComponent } from "./oauth-button";
2222
import { GoogleLogoComponent } from "../../components/logos/google";
@@ -29,7 +29,7 @@ import { GoogleLogoComponent } from "../../components/logos/google";
2929
style: "display: block;",
3030
},
3131
template: `
32-
<fui-oauth-button [provider]="googleProvider" [themed]="themed()">
32+
<fui-oauth-button [provider]="googleProvider" [themed]="themed()" (signIn)="signIn.emit($event)">
3333
<fui-google-logo />
3434
<span>{{ signInWithGoogleLabel() }}</span>
3535
</fui-oauth-button>
@@ -39,6 +39,7 @@ export class GoogleSignInButtonComponent {
3939
ui = injectUI();
4040
signInWithGoogleLabel = injectTranslation("labels", "signInWithGoogle");
4141
themed = input<boolean | "neutral">(false);
42+
signIn = output<UserCredential>();
4243

4344
private defaultProvider = new GoogleAuthProvider();
4445

packages/angular/src/lib/auth/oauth/microsoft-sign-in-button.spec.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,16 @@ describe("<fui-microsoft-sign-in-button>", () => {
9393
const button = screen.getByRole("button");
9494
expect(button).toHaveAttribute("data-provider", "microsoft.com");
9595
});
96+
97+
it("has signIn output", async () => {
98+
const { fixture } = await render(TestMicrosoftSignInButtonHostComponent);
99+
100+
const component = fixture.componentInstance;
101+
expect(component).toBeTruthy();
102+
// Verify the component has the signIn output
103+
const buttonComponent = fixture.debugElement.query(
104+
(el) => el.name === "fui-microsoft-sign-in-button"
105+
)?.componentInstance;
106+
expect(buttonComponent?.signIn).toBeDefined();
107+
});
96108
});

packages/angular/src/lib/auth/oauth/microsoft-sign-in-button.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { Component, input } from "@angular/core";
17+
import { Component, input, output } from "@angular/core";
1818
import { CommonModule } from "@angular/common";
1919
import { OAuthButtonComponent } from "./oauth-button";
2020
import { injectTranslation } from "../../provider";
21-
import { OAuthProvider } from "@angular/fire/auth";
21+
import { OAuthProvider, UserCredential } from "@angular/fire/auth";
2222
import { MicrosoftLogoComponent } from "../../components/logos/microsoft";
2323

2424
@Component({
@@ -29,7 +29,7 @@ import { MicrosoftLogoComponent } from "../../components/logos/microsoft";
2929
style: "display: block;",
3030
},
3131
template: `
32-
<fui-oauth-button [provider]="microsoftProvider" [themed]="themed()">
32+
<fui-oauth-button [provider]="microsoftProvider" [themed]="themed()" (signIn)="signIn.emit($event)">
3333
<fui-microsoft-logo />
3434
<span>{{ signInWithMicrosoftLabel() }}</span>
3535
</fui-oauth-button>
@@ -38,6 +38,7 @@ import { MicrosoftLogoComponent } from "../../components/logos/microsoft";
3838
export class MicrosoftSignInButtonComponent {
3939
signInWithMicrosoftLabel = injectTranslation("labels", "signInWithMicrosoft");
4040
themed = input<boolean>(false);
41+
signIn = output<UserCredential>();
4142

4243
private defaultProvider = new OAuthProvider("microsoft.com");
4344

0 commit comments

Comments
 (0)