Skip to content

Commit

Permalink
fix: update test
Browse files Browse the repository at this point in the history
  • Loading branch information
oasis-cloud committed Dec 4, 2024
1 parent e800642 commit 40cfc6a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,9 @@ exports[`should match snapshot 1`] = `
<div
class="nut-checkbox nut-checkbox-reverse"
>
<svg
aria-labelledby="Checked"
class="nut-icon nut-icon-Checked nut-checkbox-icon nut-checkbox-icon-checked"
role="presentation"
viewBox="0 0 1024 1024"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M512 0C230.4 0 0 230.4 0 512s230.4 512 512 512 512-230.4 512-512S793.6 0 512 0m281.6 369.78c-14.22 11.38-193.42 130.84-321.42 321.42 0 0 0 2.84-2.85 2.84-8.53 5.69-48.35 36.98-88.17-8.53-39.82-51.2-62.58-99.56-142.23-142.22-2.84 0-2.84-2.85-2.84-2.85-8.53-11.38-39.82-56.89 19.91-56.88 45.51 0 91.02 11.38 162.13 73.95 5.69 5.69 14.22 5.69 17.07 0 34.13-39.82 173.51-190.58 332.8-238.93 0 0 19.91-2.85 31.29 14.22 5.69 11.38 11.38 22.76-5.69 36.98"
fill="currentColor"
fill-opacity="0.9"
/>
</svg>
<div
class="nut-checkbox-self nut-checkbox-self-checked"
/>
<span
class="nut-checkbox-label "
>
Expand Down
22 changes: 10 additions & 12 deletions src/packages/checkbox/__test__/checkbox.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ test('should fireEvent correctly', () => {

fireEvent.click(getByTestId('checkbox3'))
fireEvent.click(getByTestId('checkbox1'))
const icons = container.querySelectorAll('.nut-checkbox-icon-checked')
const icons = container.querySelectorAll('.nut-checkbox-self-checked')
expect(icons.length).toBe(1)
expect(limit).toBeCalledWith('min')

Expand Down Expand Up @@ -117,28 +117,26 @@ test('Render checkboxs by configure indeterminate', () => {
const { container } = render(
<Checkbox value="1" checked label="labe1" indeterminate />
)
expect(
container.querySelector('.nut-checkbox-icon-indeterminate')
).toBeTruthy()
expect(container.querySelector('.nut-checkbox-self-disabled')).toBeTruthy()
})

test('Render checkboxs by configure disabled', () => {
const { container } = render(
<Checkbox value="1" checked label="labe1" disabled />
)
expect(container.querySelector('.nut-checkbox-icon-disabled')).toBeTruthy()
expect(
container.querySelector('.nut-checkbox-self-checked-disabled')
).toBeTruthy()
})

test('Render checkboxs by configure disabled and indeterminate', () => {
const { container } = render(
<Checkbox value="1" checked label="labe1" disabled indeterminate />
)
expect(
container.querySelector('.nut-checkbox-icon-indeterminate')
).toBeTruthy()
expect(
container.querySelector('.nut-checkbox-icon-indeterminate')
).toHaveClass('nut-checkbox-icon-disabled')
expect(container.querySelector('.nut-checkbox-self-disabled')).toBeTruthy()
// expect(
// container.querySelector('.nut-checkbox-self-indeterminate')
// ).toHaveClass('nut-checkbox-self-disabled')
})

test('list model should fireEvent correctly', () => {
Expand Down Expand Up @@ -181,7 +179,7 @@ test('list model should fireEvent correctly', () => {

fireEvent.click(getByTestId('checkbox3'))
fireEvent.click(getByTestId('checkbox1'))
const icons = container.querySelectorAll('.nut-checkbox-icon-checked')
const icons = container.querySelectorAll('.nut-checkbox-self-checked')
expect(icons.length).toBe(1)
expect(limit).toBeCalledWith('min')

Expand Down

0 comments on commit 40cfc6a

Please sign in to comment.