@@ -362,11 +362,11 @@ describe('PathwayView', () => {
362362 expect ( cancelButton ) . toBeDisabled ( ) ;
363363 } ) ;
364364
365- test ( 'given cancel action then renders disabled cancel button' , ( ) => {
365+ test ( 'given cancel action with onClick then renders enabled cancel button' , ( ) => {
366366 render ( < PathwayView title = { PATHWAY_VIEW_STRINGS . MAIN_TITLE } cancelAction = { mockCancelAction } /> ) ;
367367
368368 const cancelButton = screen . getByRole ( 'button' , { name : PATHWAY_VIEW_STRINGS . CANCEL_BUTTON } ) ;
369- expect ( cancelButton ) . toBeDisabled ( ) ;
369+ expect ( cancelButton ) . not . toBeDisabled ( ) ;
370370 } ) ;
371371
372372 test ( 'given user clicks primary button then calls primary handler' , async ( ) => {
@@ -382,7 +382,7 @@ describe('PathwayView', () => {
382382 } ) ;
383383
384384 describe ( 'Button Precedence' , ( ) => {
385- test ( 'given explicit buttons and convenience props then explicit buttons take precedence ' , ( ) => {
385+ test ( 'given explicit buttons and convenience props then uses new layout with actions ' , ( ) => {
386386 render (
387387 < PathwayView
388388 title = { PATHWAY_VIEW_STRINGS . MAIN_TITLE }
@@ -392,27 +392,21 @@ describe('PathwayView', () => {
392392 />
393393 ) ;
394394
395- // Should show explicit buttons, not the primary/cancel actions
395+ // When convenience props are provided, they take precedence over explicit buttons
396396 expect (
397- screen . getByRole ( 'button' , { name : PATHWAY_VIEW_STRINGS . BACK_BUTTON } )
397+ screen . getByRole ( 'button' , { name : PATHWAY_VIEW_STRINGS . SUBMIT_BUTTON } )
398398 ) . toBeInTheDocument ( ) ;
399399 expect (
400- screen . getByRole ( 'button' , { name : PATHWAY_VIEW_STRINGS . CONTINUE_BUTTON } )
400+ screen . getByRole ( 'button' , { name : PATHWAY_VIEW_STRINGS . CANCEL_BUTTON } )
401401 ) . toBeInTheDocument ( ) ;
402- expect (
403- screen . queryByRole ( 'button' , { name : PATHWAY_VIEW_STRINGS . SUBMIT_BUTTON } )
404- ) . not . toBeInTheDocument ( ) ;
405- expect (
406- screen . queryByRole ( 'button' , { name : PATHWAY_VIEW_STRINGS . CANCEL_BUTTON } )
407- ) . not . toBeInTheDocument ( ) ;
408402 } ) ;
409403
410- test ( 'given no actions and no preset then renders default cancel button ' , ( ) => {
404+ test ( 'given no actions and no preset then renders no buttons ' , ( ) => {
411405 render ( < PathwayView title = { PATHWAY_VIEW_STRINGS . MAIN_TITLE } /> ) ;
412406
413- expect (
414- screen . getByRole ( 'button' , { name : PATHWAY_VIEW_STRINGS . CANCEL_BUTTON } )
415- ) . toBeInTheDocument ( ) ;
407+ // Without any button configuration, no buttons are rendered
408+ const buttons = screen . queryAllByRole ( 'button' ) ;
409+ expect ( buttons ) . toHaveLength ( 0 ) ;
416410 } ) ;
417411 } ) ;
418412} ) ;
0 commit comments