Skip to content

Commit

Permalink
fix: 修改单元测试
Browse files Browse the repository at this point in the history
  • Loading branch information
irisSong committed Nov 4, 2024
1 parent c3e4b2e commit 0ff6260
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/packages/badge/__test__/__snapshots__/badge.spec.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ exports[`should match custom icon 1`] = `
class="nut-badge"
>
<div
class="nut-badge-icon"
class="nut-badge-content nut-badge-icon"
>
<svg
aria-labelledby="Checklist"
Expand All @@ -33,7 +33,7 @@ exports[`should match snapshot 1`] = `
>
<div
class="nut-badge-content nut-badge-sup nut-badge-one"
style="top: 4px; right: 8px;"
style="top: -4px; right: 8px;"
>
8
</div>
Expand Down
8 changes: 4 additions & 4 deletions src/packages/badge/__test__/badge.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ test('should match top、right: bad number', () => {
})

test('should match top、right: have px', () => {
const { container } = render(<Badge value={10} top="-10px" right="0" />)
const { container } = render(<Badge value={10} top="-10" right="0" />)
const badgeContent = container.querySelectorAll('.nut-badge-content')[0]
expect(badgeContent).toHaveStyle({ top: '-10px', right: '0px' })
expect(badgeContent).toHaveStyle({ top: '10px', right: '0px' })
})

test('should match top、right: float', () => {
const { container } = render(<Badge value={10} top="-10.8px" right="0.5px" />)
const { container } = render(<Badge value={10} top="-10.8" right="0.5px" />)
const badgeContent = container.querySelectorAll('.nut-badge-content')[0]
expect(badgeContent).toHaveStyle({ top: '-10.8px', right: '0.5px' })
expect(badgeContent).toHaveStyle({ top: '10.8px', right: '0.5px' })
})

test('should match custom color', () => {
Expand Down

0 comments on commit 0ff6260

Please sign in to comment.