File tree Expand file tree Collapse file tree
src/plugins/guided_onboarding/public/components Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -51,14 +51,16 @@ export const GuideButton = ({
5151
5252 // if there is no active guide
5353 if ( ! pluginState || ! pluginState . activeGuide || ! pluginState . activeGuide . isActive ) {
54- // if still active period and the user has not started a guide, quit or skipped the guide,
54+ // if still active period and the user has not started a guide or skipped the guide,
5555 // display the button that redirects to the landing page
5656 if (
57- pluginState ?. isActivePeriod &&
58- ( pluginState ?. status === 'not_started' ||
59- pluginState ?. status === 'quit ' ||
60- pluginState ?. status === 'skipped' )
57+ ! (
58+ pluginState ?. isActivePeriod &&
59+ ( pluginState ?. status === 'not_started ' || pluginState ?. status === 'skipped' )
60+ )
6161 ) {
62+ return null ;
63+ } else {
6264 return (
6365 < EuiButton
6466 onClick = { navigateToLandingPage }
@@ -73,8 +75,6 @@ export const GuideButton = ({
7375 </ EuiButton >
7476 ) ;
7577 }
76-
77- return null ;
7878 }
7979 const stepNumber = getStepNumber ( pluginState . activeGuide ) ;
8080 const stepReadyToComplete = pluginState . activeGuide . steps . find (
Original file line number Diff line number Diff line change @@ -145,23 +145,23 @@ describe('Guided setup', () => {
145145 expect ( exists ( 'guideButton' ) ) . toBe ( false ) ;
146146 } ) ;
147147
148- test ( 'shows redirect button when a user quit the guide ' , async ( ) => {
148+ test ( 'shows redirect button when a user skipped on the landing page ' , async ( ) => {
149149 const { exists } = await setupComponentWithPluginStateMock ( httpClient , {
150- status : 'quit ' ,
150+ status : 'skipped ' ,
151151 isActivePeriod : true ,
152152 } ) ;
153153
154154 expect ( exists ( 'guideButtonRedirect' ) ) . toBe ( true ) ;
155155 expect ( exists ( 'guideButton' ) ) . toBe ( false ) ;
156156 } ) ;
157157
158- test ( 'shows redirect button when a user skipped on the landing page ' , async ( ) => {
158+ test ( 'hides redirect button when a user quit the guide ' , async ( ) => {
159159 const { exists } = await setupComponentWithPluginStateMock ( httpClient , {
160- status : 'skipped ' ,
160+ status : 'quit ' ,
161161 isActivePeriod : true ,
162162 } ) ;
163163
164- expect ( exists ( 'guideButtonRedirect' ) ) . toBe ( true ) ;
164+ expect ( exists ( 'guideButtonRedirect' ) ) . toBe ( false ) ;
165165 expect ( exists ( 'guideButton' ) ) . toBe ( false ) ;
166166 } ) ;
167167
You can’t perform that action at this time.
0 commit comments