test(Pagination): update test cases

This commit is contained in:
chenjiahan 2020-11-28 19:20:11 +08:00
parent e46fb0fb7a
commit 669d2e77ae
2 changed files with 47 additions and 19 deletions

View File

@ -1,25 +1,53 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`render page slot 1`] = `
exports[`should render page slot correctly 1`] = `
<ul class="van-pagination">
<li class="van-pagination__item van-pagination__prev van-hairline">上一页</li>
<li class="van-pagination__item van-pagination__page van-hairline">1</li>
<li class="van-pagination__item van-pagination__page van-hairline">2</li>
<li class="van-pagination__item van-pagination__page van-hairline">3</li>
<li class="van-pagination__item van-pagination__page van-hairline">4</li>
<li class="van-pagination__item van-pagination__page van-hairline">5</li>
<li class="van-pagination__item van-pagination__next van-hairline">下一页</li>
<li class="van-pagination__item van-pagination__prev van-hairline">
上一页
</li>
<li class="van-pagination__item van-pagination__page van-hairline">
foo 1
</li>
<li class="van-pagination__item van-pagination__page van-hairline">
foo 2
</li>
<li class="van-pagination__item van-pagination__page van-hairline">
foo 3
</li>
<li class="van-pagination__item van-pagination__page van-hairline">
foo 4
</li>
<li class="van-pagination__item van-pagination__page van-hairline">
foo 5
</li>
<li class="van-pagination__item van-pagination__next van-hairline">
下一页
</li>
</ul>
`;
exports[`render prev-text & next-text slot 1`] = `
exports[`should render prev-text、next-text slot correctly 1`] = `
<ul class="van-pagination">
<li class="van-pagination__item van-pagination__prev van-hairline">Custom PrevText</li>
<li class="van-pagination__item van-pagination__page van-hairline">1</li>
<li class="van-pagination__item van-pagination__page van-hairline">2</li>
<li class="van-pagination__item van-pagination__page van-hairline">3</li>
<li class="van-pagination__item van-pagination__page van-hairline">4</li>
<li class="van-pagination__item van-pagination__page van-hairline">5</li>
<li class="van-pagination__item van-pagination__next van-hairline">Custom NextText</li>
<li class="van-pagination__item van-pagination__prev van-hairline">
Custom PrevText
</li>
<li class="van-pagination__item van-pagination__page van-hairline">
1
</li>
<li class="van-pagination__item van-pagination__page van-hairline">
2
</li>
<li class="van-pagination__item van-pagination__page van-hairline">
3
</li>
<li class="van-pagination__item van-pagination__page van-hairline">
4
</li>
<li class="van-pagination__item van-pagination__page van-hairline">
5
</li>
<li class="van-pagination__item van-pagination__next van-hairline">
Custom NextText
</li>
</ul>
`;

View File

@ -1,7 +1,7 @@
import { mount } from '@vue/test-utils';
import Paginaion from '..';
test('render prev-text & next-text slot', () => {
test('should render prev-text、next-text slot correctly', () => {
const wrapper = mount(Paginaion, {
props: {
totalItems: 50,
@ -16,14 +16,14 @@ test('render prev-text & next-text slot', () => {
expect(wrapper.html()).toMatchSnapshot();
});
test('render page slot', () => {
test('should render page slot correctly', () => {
const wrapper = mount(Paginaion, {
props: {
totalItems: 50,
showPageSize: 5,
},
slots: {
page: ({ text }) => `${text}`,
page: ({ text }) => `foo ${text}`,
},
});