-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Plans Step: TS and function form (#96786)
Co-authored-by: Omar Alshaker <[email protected]>
- Loading branch information
1 parent
5c2e260
commit b54e561
Showing
15 changed files
with
881 additions
and
707 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
...per/declarative-flow/internals/steps-repository/unified-plans/test/unified-plans-step.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/** @jest-environment jsdom */ | ||
jest.mock( 'calypso/signup/step-wrapper', () => () => <div data-testid="start-step-wrapper" /> ); | ||
jest.mock( '@automattic/onboarding/src/step-container', () => () => ( | ||
<div data-testid="stepper-step-wrapper" /> | ||
) ); | ||
jest.mock( 'calypso/components/marketing-message', () => 'marketing-message' ); | ||
jest.mock( 'calypso/lib/wp', () => ( { req: { post: () => {} } } ) ); | ||
|
||
import { screen, waitFor } from '@testing-library/react'; | ||
import React from 'react'; | ||
import { renderStep } from '../../test/helpers'; | ||
import UnifiedPlansStep, { type UnifiedPlansStepProps } from '../unified-plans-step'; | ||
|
||
const noop = () => {}; | ||
|
||
const props = { | ||
flowName: 'Flow name', | ||
stepName: 'Step name', | ||
stepSectionName: 'Step section name', | ||
signupDependencies: { domainItem: null }, | ||
saveSignupStep: noop, | ||
submitSignupStep: noop, | ||
goToNextStep: noop, | ||
onPlanIntervalUpdate: noop, | ||
wrapperProps: { | ||
hideBack: false, | ||
goBack: noop, | ||
isFullLayout: true, | ||
isExtraWideLayout: true, | ||
}, | ||
}; | ||
|
||
const _render = ( props: UnifiedPlansStepProps ) => { | ||
return renderStep( <UnifiedPlansStep { ...props } /> ); | ||
}; | ||
|
||
describe( 'Plans basic tests', () => { | ||
beforeEach( () => { | ||
jest.clearAllMocks(); | ||
} ); | ||
|
||
test( 'should not blow up in Start and have proper CSS class', async () => { | ||
_render( props ); | ||
const stepWrapper = await waitFor( () => screen.getByTestId( 'start-step-wrapper' ) ); | ||
expect( stepWrapper ).toBeVisible(); | ||
expect( stepWrapper.parentNode ).toHaveClass( 'plans-step' ); | ||
} ); | ||
|
||
test( 'should not blow up in Stepper and have proper CSS class', async () => { | ||
_render( { ...props, useStepperWrapper: true } ); | ||
const stepWrapper = await waitFor( () => screen.getByTestId( 'stepper-step-wrapper' ) ); | ||
expect( stepWrapper ).toBeVisible(); | ||
expect( stepWrapper.parentNode ).toHaveClass( 'plans-step' ); | ||
} ); | ||
} ); |
Oops, something went wrong.