Skip to content

Commit 2ad183a

Browse files
committed
fix(countdown): add test
1 parent eaa1c1a commit 2ad183a

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2+
3+
exports[`Countdown > type props text primary 1`] = `
4+
<div>
5+
<div
6+
class="nut-countdown "
7+
>
8+
<span
9+
class="nut-countdown-number-text"
10+
>
11+
00
12+
</span>
13+
:
14+
<span
15+
class="nut-countdown-number-text"
16+
>
17+
00
18+
</span>
19+
:
20+
<span
21+
class="nut-countdown-number-text"
22+
>
23+
00
24+
</span>
25+
</div>
26+
<div
27+
class="nut-countdown "
28+
>
29+
<span
30+
class="nut-countdown-number-primary"
31+
>
32+
00
33+
</span>
34+
:
35+
<span
36+
class="nut-countdown-number-primary"
37+
>
38+
00
39+
</span>
40+
:
41+
<span
42+
class="nut-countdown-number-primary"
43+
>
44+
00
45+
</span>
46+
</div>
47+
</div>
48+
`;

src/packages/countdown/__test__/countdown.spec.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,17 @@ describe('Countdown', () => {
4343
})
4444
})
4545

46+
test('type props text primary', async () => {
47+
const { container } = render(
48+
<>
49+
<CountDown endTime={Date.now() + 1 * 1000} type="text" />
50+
<CountDown endTime={Date.now() + 1 * 1000} type="primary" />
51+
</>
52+
)
53+
54+
expect(container).toMatchSnapshot()
55+
})
56+
4657
test('paused props', async () => {
4758
const testClick = vi.fn()
4859
let paused = false

0 commit comments

Comments
 (0)