forked from RobStino/progress-indicator-block
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprogress-indicator.test.js
More file actions
44 lines (38 loc) · 963 Bytes
/
progress-indicator.test.js
File metadata and controls
44 lines (38 loc) · 963 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/**
* External dependencies
*/
import '@testing-library/jest-dom/extend-expect';
import { render, screen } from '@testing-library/react';
/**
* Internal dependencies
*/
import ProgressIndicator from './progress-indicator';
test( 'ProgressIndicator with current step of 2/5', () => {
render(
<ProgressIndicator
attributes={ {
numberOfSteps: 5,
currentStep: 2,
color: '#10b981',
} }
/>
);
it.each( [ 2, 3, 4, 5 ], ( number ) => {
expect( screen.getByText( number ) ).toBeInTheDocument();
} );
expect( screen.getAllByRole( 'img' ).length ).toEqual( 1 );
} );
test( 'ProgressIndicator with current step of 5/5', () => {
render(
<ProgressIndicator
attributes={ {
numberOfSteps: 5,
currentStep: 5,
color: '#10b981',
} }
/>
);
expect( screen.queryByText( 4 ) ).not.toBeInTheDocument();
expect( screen.getByText( 5 ) ).toBeInTheDocument();
expect( screen.getAllByRole( 'img' ).length ).toEqual( 4 );
} );