@@ -34,24 +34,24 @@ describe('Unit Button', () => {
3434
3535 it ( 'hides title by default' , ( ) => {
3636 render ( < UnitButton { ...mockData } /> , { wrapWithRouter : true } ) ;
37- expect ( screen . getByRole ( 'link ' ) ) . not . toHaveTextContent ( unit . display_name ) ;
37+ expect ( screen . getByRole ( 'tabpanel ' ) ) . not . toHaveTextContent ( unit . display_name ) ;
3838 } ) ;
3939
4040 it ( 'shows title' , ( ) => {
41- render ( < UnitButton { ...mockData } showTitle /> ) ;
41+ render ( < UnitButton { ...mockData } showTitle /> , { wrapWithRouter : true } ) ;
4242 expect ( screen . getByRole ( 'tabpanel' ) ) . toHaveTextContent ( unit . display_name ) ;
4343 } ) ;
4444
4545 it ( 'check button attributes' , ( ) => {
46- render ( < UnitButton { ...mockData } showTitle /> ) ;
46+ render ( < UnitButton { ...mockData } showTitle /> , { wrapWithRouter : true } ) ;
4747 expect ( screen . getByRole ( 'tabpanel' ) ) . toHaveAttribute ( 'id' , `${ unit . display_name } -${ courseMetadata . id } ` ) ;
4848 expect ( screen . getByRole ( 'tabpanel' ) ) . toHaveAttribute ( 'aria-controls' , unit . display_name ) ;
4949 expect ( screen . getByRole ( 'tabpanel' ) ) . toHaveAttribute ( 'aria-labelledby' , unit . display_name ) ;
5050 expect ( screen . getByRole ( 'tabpanel' ) ) . toHaveAttribute ( 'tabindex' , '-1' ) ;
5151 } ) ;
5252
5353 it ( 'button with isActive prop has tabindex 0' , ( ) => {
54- render ( < UnitButton { ...mockData } isActive /> ) ;
54+ render ( < UnitButton { ...mockData } isActive /> , { wrapWithRouter : true } ) ;
5555 expect ( screen . getByRole ( 'tabpanel' ) ) . toHaveAttribute ( 'tabindex' , '0' ) ;
5656 } ) ;
5757
@@ -93,7 +93,7 @@ describe('Unit Button', () => {
9393 it ( 'handles the click' , ( ) => {
9494 const onClick = jest . fn ( ) ;
9595 render ( < UnitButton { ...mockData } onClick = { onClick } /> , { wrapWithRouter : true } ) ;
96- fireEvent . click ( screen . getByRole ( 'link ' ) ) ;
96+ fireEvent . click ( screen . getByRole ( 'tabpanel ' ) ) ;
9797 expect ( onClick ) . toHaveBeenCalledTimes ( 1 ) ;
9898 } ) ;
9999} ) ;
0 commit comments