Skip to content

Commit

Permalink
fix(customer): CHECKOUT-4901 Do not render passwordless link for embe…
Browse files Browse the repository at this point in the history
…dded checkout
  • Loading branch information
lpschz committed Jun 9, 2020
1 parent c01ec34 commit 2bafb5d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/app/checkout/Checkout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ class Checkout extends Component<CheckoutProps & WithCheckoutProps & WithLanguag
<LazyContainer>
<Customer
checkEmbeddedSupport={ this.checkEmbeddedSupport }
isEmbedded={ isEmbedded() }
onChangeViewType={ this.handleChangeCustomerViewType }
onContinueAsGuest={ this.navigateToNextIncompleteStep }
onContinueAsGuestError={ this.handleError }
Expand Down
15 changes: 15 additions & 0 deletions src/app/customer/Customer.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,21 @@ describe('Customer', () => {
.toEqual(false);
});

it('does not render sign-in email link when is embedded checkout', () => {
const component = mount(
<CustomerTest
isEmbedded={ true }
isSignInEmailEnabled={ true }
viewType={ CustomerViewType.Login }
/>);

expect(component.find(EmailLoginForm).exists())
.toEqual(false);

expect(component.find('[data-test="customer-signin-link"]').exists())
.toEqual(false);
});

it('passes data to login form', () => {
const component = mount(
<CustomerTest viewType={ CustomerViewType.Login } />
Expand Down
4 changes: 3 additions & 1 deletion src/app/customer/Customer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import LoginForm from './LoginForm';

export interface CustomerProps {
viewType: CustomerViewType;
isEmbedded: boolean;
checkEmbeddedSupport?(methodIds: string[]): void;
onChangeViewType?(viewType: CustomerViewType): void;
onContinueAsGuest?(): void;
Expand Down Expand Up @@ -161,6 +162,7 @@ class Customer extends Component<CustomerProps & WithCheckoutCustomerProps, Cust
private renderLoginForm(): ReactNode {
const {
createAccountUrl,
isEmbedded,
email,
forgotPasswordUrl,
isSignInEmailEnabled,
Expand All @@ -179,7 +181,7 @@ class Customer extends Component<CustomerProps & WithCheckoutCustomerProps, Cust
email={ this.draftEmail || email }
forgotPasswordUrl={ forgotPasswordUrl }
isSendingSignInEmail={ isSendingSignInEmail }
isSignInEmailEnabled={ isSignInEmailEnabled }
isSignInEmailEnabled={ isSignInEmailEnabled && !isEmbedded }
isSigningIn={ isSigningIn }
onCancel={ this.handleCancelSignIn }
onChangeEmail={ this.handleChangeEmail }
Expand Down

0 comments on commit 2bafb5d

Please sign in to comment.