Skip to content

Commit

Permalink
fix: update test
Browse files Browse the repository at this point in the history
  • Loading branch information
irisSong committed Dec 27, 2024
1 parent 6ea5f29 commit 0946c4b
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 0 deletions.
72 changes: 72 additions & 0 deletions src/packages/price/__test__/__snapshots__/price.spec.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,54 @@ exports[`props test 1`] = `
</div>
`;

exports[`props test 2`] = `
<div>
<div
class="nut-price nut-price-primary "
>
<div
class="nut-price-integer nut-price-integer-normal "
>
1,010
</div>
<div
class="nut-price-decimal nut-price-decimal-normal "
>
.
</div>
<div
class="nut-price-decimal nut-price-decimal-normal "
>
00
</div>
</div>
</div>
`;

exports[`props test 3`] = `
<div>
<div
class="nut-price nut-price-primary "
>
<div
class="nut-price-integer nut-price-integer-normal "
>
1,010
</div>
<div
class="nut-price-decimal nut-price-decimal-normal "
>
.
</div>
<div
class="nut-price-decimal nut-price-decimal-normal "
>
00
</div>
</div>
</div>
`;

exports[`props thousands test 1`] = `
<div>
<div
Expand Down Expand Up @@ -110,3 +158,27 @@ exports[`props thousands test 1`] = `
</div>
</div>
`;

exports[`props type 1`] = `
<div>
<div
class="nut-price nut-price-primary "
>
<div
class="nut-price-integer nut-price-integer-normal "
>
1,010
</div>
<div
class="nut-price-decimal nut-price-decimal-normal "
>
.
</div>
<div
class="nut-price-decimal nut-price-decimal-normal "
>
00
</div>
</div>
</div>
`;
12 changes: 12 additions & 0 deletions src/packages/price/__test__/price.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,15 @@ test('props digits test', () => {
)
expect(container).toMatchSnapshot()
})

test('props size', () => {
const { container } = render(<Price price={1010} size="large" />)
expect(container.querySelector('.nut-price-integer')).toHaveClass(
'nut-price-integer-large'
)
})

test('props type', () => {
const { container } = render(<Price price={1010} type="primary" />)
expect(container.querySelector('.nut-price')).toHaveClass('nut-price-primary')
})

0 comments on commit 0946c4b

Please sign in to comment.