@@ -34,24 +34,24 @@ describe('Unit Button', () => {
34
34
35
35
it ( 'hides title by default' , ( ) => {
36
36
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 ) ;
38
38
} ) ;
39
39
40
40
it ( 'shows title' , ( ) => {
41
- render ( < UnitButton { ...mockData } showTitle /> ) ;
41
+ render ( < UnitButton { ...mockData } showTitle /> , { wrapWithRouter : true } ) ;
42
42
expect ( screen . getByRole ( 'tabpanel' ) ) . toHaveTextContent ( unit . display_name ) ;
43
43
} ) ;
44
44
45
45
it ( 'check button attributes' , ( ) => {
46
- render ( < UnitButton { ...mockData } showTitle /> ) ;
46
+ render ( < UnitButton { ...mockData } showTitle /> , { wrapWithRouter : true } ) ;
47
47
expect ( screen . getByRole ( 'tabpanel' ) ) . toHaveAttribute ( 'id' , `${ unit . display_name } -${ courseMetadata . id } ` ) ;
48
48
expect ( screen . getByRole ( 'tabpanel' ) ) . toHaveAttribute ( 'aria-controls' , unit . display_name ) ;
49
49
expect ( screen . getByRole ( 'tabpanel' ) ) . toHaveAttribute ( 'aria-labelledby' , unit . display_name ) ;
50
50
expect ( screen . getByRole ( 'tabpanel' ) ) . toHaveAttribute ( 'tabindex' , '-1' ) ;
51
51
} ) ;
52
52
53
53
it ( 'button with isActive prop has tabindex 0' , ( ) => {
54
- render ( < UnitButton { ...mockData } isActive /> ) ;
54
+ render ( < UnitButton { ...mockData } isActive /> , { wrapWithRouter : true } ) ;
55
55
expect ( screen . getByRole ( 'tabpanel' ) ) . toHaveAttribute ( 'tabindex' , '0' ) ;
56
56
} ) ;
57
57
@@ -93,7 +93,7 @@ describe('Unit Button', () => {
93
93
it ( 'handles the click' , ( ) => {
94
94
const onClick = jest . fn ( ) ;
95
95
render ( < UnitButton { ...mockData } onClick = { onClick } /> , { wrapWithRouter : true } ) ;
96
- fireEvent . click ( screen . getByRole ( 'link ' ) ) ;
96
+ fireEvent . click ( screen . getByRole ( 'tabpanel ' ) ) ;
97
97
expect ( onClick ) . toHaveBeenCalledTimes ( 1 ) ;
98
98
} ) ;
99
99
} ) ;
0 commit comments