|
1 | 1 | import { CBox, CCheckbox, CCheckboxGroup } from '../..'
|
2 |
| -import { render } from '@/tests/test-utils' |
| 2 | +import { render, screen, wait } from '@/tests/test-utils' |
3 | 3 |
|
4 | 4 | // mocks
|
5 | 5 | import { useId } from '@/packages/chakra-ui-core/src/utils'
|
@@ -33,20 +33,18 @@ it('should render correctly', () => {
|
33 | 33 | })
|
34 | 34 |
|
35 | 35 | it('should display children', () => {
|
36 |
| - const { getByText } = renderComponent() |
37 |
| - expect(getByText('One')).toBeInTheDocument() |
38 |
| - expect(getByText('Two')).toBeInTheDocument() |
39 |
| - expect(getByText('Three')).toBeInTheDocument() |
| 36 | + renderComponent() |
| 37 | + expect(screen.getByText('One')).toBeInTheDocument() |
| 38 | + expect(screen.getByText('Two')).toBeInTheDocument() |
| 39 | + expect(screen.getByText('Three')).toBeInTheDocument() |
40 | 40 | })
|
41 | 41 |
|
42 | 42 | test('selectedValues prop works', () => {
|
43 |
| - const { getByTestId } = renderComponent() |
| 43 | + renderComponent() |
44 | 44 |
|
45 |
| - const one = getByTestId('one').querySelector('input') |
46 |
| - const two = getByTestId('two').querySelector('input') |
47 |
| - const three = getByTestId('three').querySelector('input') |
48 |
| - |
49 |
| - expect(one).not.toBeChecked() |
50 |
| - expect(two).toBeChecked() |
51 |
| - expect(three).not.toBeChecked() |
| 45 | + wait(() => { |
| 46 | + expect(screen.getByLabelText('One')).not.toBeChecked() |
| 47 | + expect(screen.getByLabelText('Two')).toBeChecked() |
| 48 | + expect(screen.getByLabelText('Three')).not.toBeChecked() |
| 49 | + }) |
52 | 50 | })
|
0 commit comments