@@ -263,4 +263,43 @@ describe('Header & Footer', () => {
263263 expect ( getByText ( 'My Test Label' ) ) . toBeInTheDocument ( )
264264 } )
265265 } )
266+
267+ it ( 'should disable help button when not in collect mode' , async ( ) => {
268+ vi . mocked ( useMode ) . mockReturnValueOnce ( MODE_TYPE . VISUALIZE )
269+
270+ const { getAllByText } = renderWithRouter (
271+ < TelemetryContext . Provider
272+ value = { {
273+ isTelemetryEnabled : true ,
274+ pushEvent : vi . fn ( ) ,
275+ setDefaultValues : ( ) => { } ,
276+ } }
277+ >
278+ < Header />
279+ </ TelemetryContext . Provider > ,
280+ )
281+
282+ const helpButton = getAllByText ( 'Need help?' ) [ 0 ]
283+ expect ( helpButton ) . toHaveAttribute ( 'disabled' )
284+ } )
285+
286+ it ( 'should disable help button when assistance url is not provided' , async ( ) => {
287+ vi . stubEnv ( 'VITE_PORTAIL_URL' , '' )
288+
289+ vi . mocked ( useMode ) . mockReturnValueOnce ( MODE_TYPE . COLLECT )
290+ const { getAllByText } = renderWithRouter (
291+ < TelemetryContext . Provider
292+ value = { {
293+ isTelemetryEnabled : true ,
294+ pushEvent : vi . fn ( ) ,
295+ setDefaultValues : ( ) => { } ,
296+ } }
297+ >
298+ < Header />
299+ </ TelemetryContext . Provider > ,
300+ )
301+
302+ const helpButton = getAllByText ( 'Need help?' ) [ 0 ]
303+ expect ( helpButton ) . toHaveAttribute ( 'disabled' )
304+ } )
266305} )
0 commit comments