Skip to content
This repository was archived by the owner on Sep 20, 2024. It is now read-only.

Commit efd6965

Browse files
committed
test(list): add tests for List component
1 parent e988316 commit efd6965

File tree

2 files changed

+75
-0
lines changed

2 files changed

+75
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { CList, CListItem, CListIcon } from '../..'
2+
import { render } from '@/tests/test-utils'
3+
4+
const renderComponent = (props) => {
5+
const base = {
6+
components: { CList, CListItem, CListIcon },
7+
template: `
8+
<CList spacing="3">
9+
<CListItem>
10+
<CListIcon icon="check-circle" color="green.500" />Lorem ipsum dolor sit amet, consectetur adipisicing elit
11+
</CListItem>
12+
<CListItem>
13+
<CListIcon icon="check-circle" color="green.500" />Assumenda, quia temporibus eveniet a libero incidunt suscipit
14+
</CListItem>
15+
</CList>`,
16+
...props
17+
}
18+
return render(base)
19+
}
20+
21+
it('should render correctly', () => {
22+
const { asFragment } = renderComponent()
23+
expect(asFragment()).toMatchSnapshot()
24+
})
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`should render correctly 1`] = `
4+
<DocumentFragment>
5+
<ul
6+
class="css-kzncz7"
7+
data-chakra-component="CList"
8+
>
9+
<li
10+
class="css-fzcsno css-1u7dvmo"
11+
data-chakra-component="CListItem"
12+
>
13+
<svg
14+
class="css-4phyzl css-y3asau"
15+
data-chakra-component="CListIcon"
16+
role="presentation"
17+
viewBox="0 0 24 24"
18+
>
19+
20+
21+
<path
22+
d="M12,0A12,12,0,1,0,24,12,12.014,12.014,0,0,0,12,0Zm6.927,8.2-6.845,9.289a1.011,1.011,0,0,1-1.43.188L5.764,13.769a1,1,0,1,1,1.25-1.562l4.076,3.261,6.227-8.451A1,1,0,1,1,18.927,8.2Z"
23+
fill="currentColor"
24+
/>
25+
</svg>
26+
Lorem ipsum dolor sit amet, consectetur adipisicing elit
27+
28+
</li>
29+
<li
30+
class="css-fzcsno css-fzcsno"
31+
data-chakra-component="CListItem"
32+
>
33+
<svg
34+
class="css-4phyzl css-y3asau"
35+
data-chakra-component="CListIcon"
36+
role="presentation"
37+
viewBox="0 0 24 24"
38+
>
39+
40+
41+
<path
42+
d="M12,0A12,12,0,1,0,24,12,12.014,12.014,0,0,0,12,0Zm6.927,8.2-6.845,9.289a1.011,1.011,0,0,1-1.43.188L5.764,13.769a1,1,0,1,1,1.25-1.562l4.076,3.261,6.227-8.451A1,1,0,1,1,18.927,8.2Z"
43+
fill="currentColor"
44+
/>
45+
</svg>
46+
Assumenda, quia temporibus eveniet a libero incidunt suscipit
47+
48+
</li>
49+
</ul>
50+
</DocumentFragment>
51+
`;

0 commit comments

Comments
 (0)