Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stepper: Use AsyncLoad for unified plans #94783

Merged
merged 3 commits into from
Sep 24, 2024
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
9 changes: 5 additions & 4 deletions client/signup/steps/plans/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
isTailoredSignupFlow,
isOnboardingGuidedFlow,
ONBOARDING_GUIDED_FLOW,
StepContainer as StepperStepContainer,
} from '@automattic/onboarding';
import { isDesktop, subscribeIsDesktop } from '@automattic/viewport';
import clsx from 'clsx';
Expand All @@ -15,6 +14,7 @@ import PropTypes from 'prop-types';
import { parse as parseQs } from 'qs';
import React, { Component } from 'react';
import { connect } from 'react-redux';
import AsyncLoad from 'calypso/components/async-load';
import FormattedHeader from 'calypso/components/formatted-header';
import { LoadingEllipsis } from 'calypso/components/loading-ellipsis';
import MarketingMessage from 'calypso/components/marketing-message';
Expand All @@ -25,7 +25,6 @@ import { triggerGuidesForStep } from 'calypso/lib/guides/trigger-guides-for-step
import { buildUpgradeFunction } from 'calypso/lib/signup/step-actions';
import { getSegmentedIntent } from 'calypso/my-sites/plans/utils/get-segmented-intent';
import PlansFeaturesMain from 'calypso/my-sites/plans-features-main';
import StartStepWrapper from 'calypso/signup/step-wrapper';
import { getStepUrl } from 'calypso/signup/utils';
import { recordTracksEvent } from 'calypso/state/analytics/actions';
import { getCurrentUserSiteCount } from 'calypso/state/current-user/selectors';
Expand Down Expand Up @@ -307,7 +306,8 @@ export class PlansStep extends Component {

if ( useStepperWrapper ) {
return (
<StepperStepContainer
<AsyncLoad
require="@automattic/onboarding/src/step-container"
flowName={ flowName }
stepName={ stepName }
formattedHeader={
Expand All @@ -329,7 +329,8 @@ export class PlansStep extends Component {
}

return (
<StartStepWrapper
<AsyncLoad
require="calypso/signup/step-wrapper"
flowName={ flowName }
stepName={ stepName }
positionInFlow={ positionInFlow }
Expand Down
6 changes: 3 additions & 3 deletions client/signup/steps/plans/test/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
PLAN_JETPACK_BUSINESS,
PLAN_JETPACK_BUSINESS_MONTHLY,
} from '@automattic/calypso-products';
import { render, screen } from '@testing-library/react';
import { render, screen, waitFor } from '@testing-library/react';
import { PlansStep, isDotBlogDomainRegistration } from '../index';

const noop = () => {};
Expand All @@ -48,9 +48,9 @@ function getCartItems( overrides ) {
}

describe( 'Plans basic tests', () => {
test( 'should not blow up and have proper CSS class', () => {
test( 'should not blow up and have proper CSS class', async () => {
render( <PlansStep { ...props } /> );
const stepWrapper = screen.getByTestId( 'step-wrapper' );
const stepWrapper = await waitFor( () => screen.getByTestId( 'step-wrapper' ) );
expect( stepWrapper ).toBeVisible();
expect( stepWrapper.parentNode ).toHaveClass( 'plans-step' );
} );
Expand Down
Loading