Browse Source

chore: update Item component test case (#34686)

Co-authored-by: Zack Chang <zackchangjx@foxmail.com>
pull/34695/head
Zack Chang 3 years ago
committed by GitHub
parent
commit
5e0c232077
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      components/list/__tests__/Item.test.js
  2. 164
      components/list/__tests__/__snapshots__/Item.test.js.snap

4
components/list/__tests__/Item.test.js

@ -151,7 +151,7 @@ describe('List Item Layout', () => {
renderItem={item => <List.Item>{item.title}</List.Item>} renderItem={item => <List.Item>{item.title}</List.Item>}
/>, />,
); );
expect(wrapper).toMatchSnapshot(); expect(wrapper.render()).toMatchSnapshot();
}); });
it('rowKey could be function', () => { it('rowKey could be function', () => {
@ -176,6 +176,6 @@ describe('List Item Layout', () => {
renderItem={item => <List.Item>{item.title}</List.Item>} renderItem={item => <List.Item>{item.title}</List.Item>}
/>, />,
); );
expect(wrapper).toMatchSnapshot(); expect(wrapper.render()).toMatchSnapshot();
}); });
}); });

164
components/list/__tests__/__snapshots__/Item.test.js.snap

@ -58,139 +58,71 @@ exports[`List Item Layout horizontal itemLayout List should accept extra node 1`
`; `;
exports[`List Item Layout rowKey could be function 1`] = ` exports[`List Item Layout rowKey could be function 1`] = `
<List <div
dataSource={ class="ant-list ant-list-split"
Array [
Object {
"id": 1,
"title": "ant design",
},
Object {
"id": 2,
"title": "ant design",
},
Object {
"id": 3,
"title": "ant design",
},
]
}
renderItem={[Function]}
rowKey={[Function]}
> >
<div <div
className="ant-list ant-list-split" class="ant-spin-nested-loading"
> >
<Spin <div
size="default" class="ant-spin-container"
spinning={false}
wrapperClassName=""
> >
<div <ul
className="ant-spin-nested-loading" class="ant-list-items"
> >
<div <li
className="ant-spin-container" class="ant-list-item"
key="container"
> >
<ul ant design
className="ant-list-items" </li>
> <li
<Item> class="ant-list-item"
<li >
className="ant-list-item" ant design
> </li>
ant design <li
</li> class="ant-list-item"
</Item> >
<Item> ant design
<li </li>
className="ant-list-item" </ul>
> </div>
ant design
</li>
</Item>
<Item>
<li
className="ant-list-item"
>
ant design
</li>
</Item>
</ul>
</div>
</div>
</Spin>
</div> </div>
</List> </div>
`; `;
exports[`List Item Layout rowKey could be string 1`] = ` exports[`List Item Layout rowKey could be string 1`] = `
<List <div
dataSource={ class="ant-list ant-list-split"
Array [
Object {
"id": 1,
"title": "ant design",
},
Object {
"id": 2,
"title": "ant design",
},
Object {
"id": 3,
"title": "ant design",
},
]
}
renderItem={[Function]}
rowKey="id"
> >
<div <div
className="ant-list ant-list-split" class="ant-spin-nested-loading"
> >
<Spin <div
size="default" class="ant-spin-container"
spinning={false}
wrapperClassName=""
> >
<div <ul
className="ant-spin-nested-loading" class="ant-list-items"
> >
<div <li
className="ant-spin-container" class="ant-list-item"
key="container"
> >
<ul ant design
className="ant-list-items" </li>
> <li
<Item> class="ant-list-item"
<li >
className="ant-list-item" ant design
> </li>
ant design <li
</li> class="ant-list-item"
</Item> >
<Item> ant design
<li </li>
className="ant-list-item" </ul>
> </div>
ant design
</li>
</Item>
<Item>
<li
className="ant-list-item"
>
ant design
</li>
</Item>
</ul>
</div>
</div>
</Spin>
</div> </div>
</List> </div>
`; `;
exports[`List Item Layout should render in RTL direction 1`] = ` exports[`List Item Layout should render in RTL direction 1`] = `

Loading…
Cancel
Save