File tree Expand file tree Collapse file tree 2 files changed +39
-1
lines changed
static/gsApp/views/amCheckout/steps Expand file tree Collapse file tree 2 files changed +39
-1
lines changed Original file line number Diff line number Diff line change @@ -87,4 +87,23 @@ describe('StepHeader', () => {
87
87
expect ( onEdit ) . not . toHaveBeenCalled ( ) ;
88
88
await userEvent . click ( screen . getByText ( mockTitle ) ) ;
89
89
} ) ;
90
+
91
+ it ( 'renders for new checkout' , function ( ) {
92
+ render (
93
+ < StepHeader
94
+ isNewCheckout
95
+ title = { mockTitle }
96
+ stepNumber = { stepNumber }
97
+ onEdit = { onEdit }
98
+ isActive = { false }
99
+ isCompleted = { false }
100
+ />
101
+ ) ;
102
+
103
+ expect ( screen . getByText ( mockTitle ) ) . toBeInTheDocument ( ) ;
104
+ expect ( screen . queryByText ( `${ stepNumber } .` ) ) . not . toBeInTheDocument ( ) ;
105
+ expect ( screen . queryByTestId ( 'icon-check-mark' ) ) . not . toBeInTheDocument ( ) ;
106
+ expect ( screen . queryByText ( 'Edit' ) ) . not . toBeInTheDocument ( ) ;
107
+ expect ( screen . queryByLabelText ( 'Expand section' ) ) . not . toBeInTheDocument ( ) ;
108
+ } ) ;
90
109
} ) ;
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ type Props = {
23
23
*/
24
24
canSkip ?: boolean ;
25
25
checkoutTier ?: PlanTier ;
26
+ isNewCheckout ?: boolean ;
26
27
onToggleLegacy ?: ( tier : string ) => void ;
27
28
organization ?: Organization ;
28
29
trailingItems ?: React . ReactNode ;
@@ -39,17 +40,30 @@ function StepHeader({
39
40
onToggleLegacy,
40
41
checkoutTier,
41
42
organization,
43
+ isNewCheckout,
42
44
} : Props ) {
43
45
const canEdit = ! isActive && ( isCompleted || canSkip ) ;
44
46
const toggleTier = getToggleTier ( checkoutTier ) ;
45
47
const onEditClick = canEdit ? ( ) => onEdit ( stepNumber ) : undefined ;
48
+ const dataTestId = `header-${ kebabCase ( title ) } ` ;
49
+
50
+ if ( isNewCheckout ) {
51
+ return (
52
+ < Flex justify = "between" >
53
+ < NewCheckoutStepTitle id = { `step-${ stepNumber } ` } data-test-id = { dataTestId } >
54
+ { title }
55
+ </ NewCheckoutStepTitle >
56
+ { trailingItems && < div > { trailingItems } </ div > }
57
+ </ Flex >
58
+ ) ;
59
+ }
46
60
47
61
return (
48
62
< Header
49
63
isActive = { isActive }
50
64
canEdit = { canEdit }
51
65
onClick = { onEditClick }
52
- data-test-id = { `header- ${ kebabCase ( title ) } ` }
66
+ data-test-id = { dataTestId }
53
67
>
54
68
< Flex justify = "between" >
55
69
< StepTitle >
@@ -119,3 +133,8 @@ const EditStep = styled('div')`
119
133
gap: ${ space ( 1 ) } ;
120
134
align-items: center;
121
135
` ;
136
+
137
+ const NewCheckoutStepTitle = styled ( 'div' ) `
138
+ font-size: ${ p => p . theme . fontSize [ '2xl' ] } ;
139
+ font-weight: ${ p => p . theme . fontWeight . bold } ;
140
+ ` ;
You can’t perform that action at this time.
0 commit comments