Skip to content

Commit

Permalink
fixing chromatic
Browse files Browse the repository at this point in the history
  • Loading branch information
LauraPinilla committed Jul 26, 2024
1 parent 39fa84a commit d14102f
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .storybook/themes/news.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3643,7 +3643,7 @@
),
"social-sign-on-button-container-apple-custom": (
"inline-size": 100%
)
),
"social-sign-on-button-container-facebook": (
"justify-content": center,
"border-block-start-width": 1px,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,21 @@ function FacebookSignIn({ customButtons, socialSignOnIn, className }) {

if (customButtons) {
return (
<Button
id="facebook-btn"
variant="secondary-reverse"
iconLeft={FacebookIcon}
className={`${className}__Facebook`}
onClick={() => window?.onFacebookSignOn()}
>
{socialSignOnIn !== SIGN_UP ? (
<span>{phrases.t("identity-block.social-signOn-facebook-login")}</span>
) : (
<span>{phrases.t("identity-block.social-signOn-facebook-signUp")}</span>
)}
</Button>
<div data-testid="custom-facebook-btn">
<Button
id="facebook-btn"
variant="secondary-reverse"
iconLeft={FacebookIcon}
className={`${className}__Facebook`}
onClick={() => window?.onFacebookSignOn()}
>
{socialSignOnIn !== SIGN_UP ? (
<span>{phrases.t("identity-block.social-signOn-facebook-login")}</span>
) : (
<span>{phrases.t("identity-block.social-signOn-facebook-signUp")}</span>
)}
</Button>
</div>
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,33 @@ function GoogleSignIn({ customButtons, socialSignOnIn, className }) {

if (customButtons) {
return (
<Button
id="custom-google-signin-btn"
variant="secondary-reverse"
iconLeft={GoogleIcon}
className={`${className}__Google`}
onClick={() =>
window.google.accounts.id.prompt((notification) => {
if (notification.isSkippedMoment()) {
// https://developers.google.com/identity/gsi/web/reference/js-reference
// https://developers.google.com/identity/gsi/web/guides/features#exponential_cooldown
// eslint-disable-next-line
alert(googleNotification);
// Remove cookie works in Safari
document.cookie = `g_state=;path=/;expires=Thu, 01 Jan 1970 00:00:01 GMT`;
window.google.accounts.id.prompt();
}
})
}
>
{socialSignOnIn !== SIGN_UP ? (
<span>{phrases.t("identity-block.social-signOn-google-login")}</span>
) : (
<span>{phrases.t("identity-block.social-signOn-google-signUp")}</span>
)}
</Button>
<div data-testid="custom-google-sign-in-button">
<Button
id="custom-google-signin-btn"
variant="secondary-reverse"
iconLeft={GoogleIcon}
className={`${className}__Google`}
onClick={() =>
window.google.accounts.id.prompt((notification) => {
if (notification.isSkippedMoment()) {
// https://developers.google.com/identity/gsi/web/reference/js-reference
// https://developers.google.com/identity/gsi/web/guides/features#exponential_cooldown
// eslint-disable-next-line
alert(googleNotification);
// Remove cookie works in Safari
document.cookie = `g_state=;path=/;expires=Thu, 01 Jan 1970 00:00:01 GMT`;
window.google.accounts.id.prompt();
}
})
}
>
{socialSignOnIn !== SIGN_UP ? (
<span>{phrases.t("identity-block.social-signOn-google-login")}</span>
) : (
<span>{phrases.t("identity-block.social-signOn-google-signUp")}</span>
)}
</Button>
</div>
);
}
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ describe("Identity Social Login Component", () => {
</GoogleSignInProvider>,
);

expect(screen.getByTestId('custom-google-signin-btn')).toBeInTheDocument();
expect(screen.getByTestId('custom-google-sign-in-button')).toBeInTheDocument();
expect(screen.queryByTestId('fb-login-button')).not.toBeInTheDocument();
});

Expand Down Expand Up @@ -145,7 +145,7 @@ describe("Identity Social Login Component", () => {
</GoogleSignInProvider>,
);

expect(screen.getByTestId('facebook-btn')).toBeInTheDocument();
expect(screen.getByTestId('custom-facebook-btn')).toBeInTheDocument();
expect(screen.queryByTestId('google-sign-in-button')).not.toBeInTheDocument();
});

Expand Down

0 comments on commit d14102f

Please sign in to comment.