File tree Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -6,12 +6,12 @@ const mockPath = '/projects';
6
6
const mockLinkText = 'Projects' ;
7
7
8
8
describe ( 'Tab' , ( ) => {
9
- function rerender ( ) {
9
+ function mountComponent ( ) {
10
10
return render ( < Tab to = { mockPath } > { mockLinkText } </ Tab > ) ;
11
11
}
12
12
13
13
it ( 'renders a react-router NavLink with correct text and path' , async ( ) => {
14
- rerender ( ) ;
14
+ mountComponent ( ) ;
15
15
16
16
const linkElement = screen . getByText ( mockLinkText ) ;
17
17
expect ( linkElement ) . toBeInTheDocument ( ) ;
@@ -22,7 +22,7 @@ describe('Tab', () => {
22
22
} ) ;
23
23
24
24
it ( 'includes the dashboard-header class names' , ( ) => {
25
- const { container } = rerender ( ) ;
25
+ const { container } = mountComponent ( ) ;
26
26
27
27
const listItem = container . querySelector ( 'li' ) ;
28
28
const link = container . querySelector ( 'a' ) ;
Original file line number Diff line number Diff line change @@ -30,35 +30,35 @@ describe('useModalClose', () => {
30
30
) ;
31
31
}
32
32
33
- function rerender ( ) {
33
+ function mountComponent ( ) {
34
34
return render ( < TestModal handleClose = { onClose } /> ) ;
35
35
}
36
36
37
37
it ( 'calls onClose when clicking outside the modal' , ( ) => {
38
- const { getByTestId } = rerender ( ) ;
38
+ const { getByTestId } = mountComponent ( ) ;
39
39
40
40
fireEvent . click ( getByTestId ( 'outside' ) ) ;
41
41
42
42
expect ( onClose ) . toHaveBeenCalled ( ) ;
43
43
} ) ;
44
44
45
45
it ( 'does not call onClose when clicking inside the modal' , ( ) => {
46
- const { getByTestId } = rerender ( ) ;
46
+ const { getByTestId } = mountComponent ( ) ;
47
47
48
48
fireEvent . click ( getByTestId ( 'modal' ) ) ;
49
49
50
50
expect ( onClose ) . not . toHaveBeenCalled ( ) ;
51
51
} ) ;
52
52
53
53
it ( 'returns a ref that is focused on mount' , ( ) => {
54
- const { getByTestId } = rerender ( ) ;
54
+ const { getByTestId } = mountComponent ( ) ;
55
55
const modal = getByTestId ( 'modal' ) ;
56
56
57
57
expect ( document . activeElement ) . toBe ( modal ) ;
58
58
} ) ;
59
59
60
60
it ( 'calls useKeyDownHandlers with escape handler' , ( ) => {
61
- rerender ( ) ;
61
+ mountComponent ( ) ;
62
62
63
63
expect ( useKeyDownHandlers ) . toHaveBeenCalledWith ( { escape : onClose } ) ;
64
64
} ) ;
You can’t perform that action at this time.
0 commit comments