test: update snap

pull/4675/head
tangjinzhou 2021-09-19 16:26:23 +08:00
parent b2b27aeba7
commit 2d03466bf1
8 changed files with 18 additions and 15 deletions

View File

@ -19,7 +19,7 @@ exports[`renders ./components/image/demo/fallback.vue correctly 1`] = `
exports[`renders ./components/image/demo/placeholder.vue correctly 1`] = `
<div class="ant-space ant-space-horizontal ant-space-align-center">
<div class="ant-space-item" style="margin-right: 12px;">
<div class="ant-image" style="width: 200px;"><img class="ant-image-img" src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png?1479744000000">
<div class="ant-image" style="width: 200px;"><img class="ant-image-img" src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png?1479772800000">
<div aria-hidden="true" class="ant-image-placeholder">
<div class="ant-image" style="width: 200px;"><img class="ant-image-img" src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png?x-oss-process=image/blur,r_50,s_50/quality,q_1/resize,m_mfit,h_200,w_200">
<!---->

View File

@ -76,17 +76,14 @@ describe('Table.pagination', () => {
});
});
it('paginate data', done => {
it('paginate data', async () => {
const wrapper = mount(Table, getTableOptions());
Vue.nextTick(() => {
expect(renderedNames(wrapper)).toEqual(['Jack', 'Lucy']);
const pager = wrapper.findAllComponents({ name: 'Pager' });
pager.at(pager.length - 1).trigger('click');
Vue.nextTick(() => {
expect(renderedNames(wrapper)).toEqual(['Tom', 'Jerry']);
done();
});
});
await sleep();
expect(renderedNames(wrapper)).toEqual(['Jack', 'Lucy']);
const pager = wrapper.findAllComponents({ name: 'Pager' });
pager.at(pager.length - 1).trigger('click');
await sleep();
expect(renderedNames(wrapper)).toEqual(['Tom', 'Jerry']);
});
it('repaginates when pageSize change', () => {

View File

@ -260,7 +260,7 @@ describe('Table.rowSelection', () => {
expect(handleSelectInvert).toBeCalledWith([1, 2, 3]);
});
it('fires selection event', () => {
it('fires selection event', async () => {
const handleSelectOdd = jest.fn();
const handleSelectEven = jest.fn();
const rowSelection = {
@ -289,6 +289,7 @@ describe('Table.rowSelection', () => {
},
{ sync: false },
);
await sleep();
expect(dropdownWrapper.findAll('.ant-dropdown-menu-item').length).toBe(4);
dropdownWrapper.findAll('.ant-dropdown-menu-item')[2].trigger('click');
@ -399,6 +400,7 @@ describe('Table.rowSelection', () => {
dataSource: newData,
}),
);
await sleep();
const pager = wrapper.findAllComponents({ name: 'Pager' });
pager.at(pager.length - 1).trigger('click'); // switch to second page
wrapper.findAll('input')[0].element.checked = true;

View File

@ -147,7 +147,7 @@ exports[`renders ./components/time-picker/demo/value.vue correctly 1`] = `
<p>Do not change</p>
<!---->
<div class="ant-picker">
<div class="ant-picker-input"><input readonly="" placeholder="Select time" title="00:00:00" size="10" autocomplete="off"><span class="ant-picker-suffix"><span role="img" aria-label="clock-circle" class="anticon anticon-clock-circle"><svg focusable="false" class="" data-icon="clock-circle" width="1em" height="1em" fill="currentColor" aria-hidden="true" viewBox="64 64 896 896"><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"></path><path d="M686.7 638.6L544.1 535.5V288c0-4.4-3.6-8-8-8H488c-4.4 0-8 3.6-8 8v275.4c0 2.6 1.2 5 3.3 6.5l165.4 120.6c3.6 2.6 8.6 1.8 11.2-1.7l28.6-39c2.6-3.7 1.8-8.7-1.8-11.2z"></path></svg></span></span><span class="ant-picker-clear" role="button"><span role="img" aria-label="close-circle" class="anticon anticon-close-circle"><svg focusable="false" class="" data-icon="close-circle" width="1em" height="1em" fill="currentColor" aria-hidden="true" viewBox="64 64 896 896"><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm165.4 618.2l-66-.3L512 563.4l-99.3 118.4-66.1.3c-4.4 0-8-3.5-8-8 0-1.9.7-3.7 1.9-5.2l130.1-155L340.5 359a8.32 8.32 0 01-1.9-5.2c0-4.4 3.6-8 8-8l66.1.3L512 464.6l99.3-118.4 66-.3c4.4 0 8 3.5 8 8 0 1.9-.7 3.7-1.9 5.2L553.5 514l130 155c1.2 1.5 1.9 3.3 1.9 5.2 0 4.4-3.6 8-8 8z"></path></svg></span></span></div>
<div class="ant-picker-input"><input readonly="" placeholder="Select time" title="08:00:00" size="10" autocomplete="off"><span class="ant-picker-suffix"><span role="img" aria-label="clock-circle" class="anticon anticon-clock-circle"><svg focusable="false" class="" data-icon="clock-circle" width="1em" height="1em" fill="currentColor" aria-hidden="true" viewBox="64 64 896 896"><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"></path><path d="M686.7 638.6L544.1 535.5V288c0-4.4-3.6-8-8-8H488c-4.4 0-8 3.6-8 8v275.4c0 2.6 1.2 5 3.3 6.5l165.4 120.6c3.6 2.6 8.6 1.8 11.2-1.7l28.6-39c2.6-3.7 1.8-8.7-1.8-11.2z"></path></svg></span></span><span class="ant-picker-clear" role="button"><span role="img" aria-label="close-circle" class="anticon anticon-close-circle"><svg focusable="false" class="" data-icon="close-circle" width="1em" height="1em" fill="currentColor" aria-hidden="true" viewBox="64 64 896 896"><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm165.4 618.2l-66-.3L512 563.4l-99.3 118.4-66.1.3c-4.4 0-8-3.5-8-8 0-1.9.7-3.7 1.9-5.2l130.1-155L340.5 359a8.32 8.32 0 01-1.9-5.2c0-4.4 3.6-8 8-8l66.1.3L512 464.6l99.3-118.4 66-.3c4.4 0 8 3.5 8 8 0 1.9-.7 3.7-1.9 5.2L553.5 514l130 155c1.2 1.5 1.9 3.3 1.9 5.2 0 4.4-3.6 8-8 8z"></path></svg></span></span></div>
</div>
</div>
`;

View File

@ -188,6 +188,7 @@
"prettier": "^2.2.0",
"pretty-quick": "^3.0.0",
"prismjs": "^1.23.0",
"query-string": "^7.0.1",
"querystring": "^0.2.0",
"raw-loader": "^4.0.2",
"reqwest": "^2.0.5",

View File

@ -1,3 +1,4 @@
/* eslint-disable import/no-unresolved */
import Layout from '../layouts/index.vue';
import Iframe from '../layouts/Iframe.vue';
// import Iframe from '../components/iframe.jsx';

View File

@ -1,5 +1,5 @@
import router from '../../../router';
import { parse } from 'query-string';
import router from '../../../router';
import { fakeAccountLogin } from './service';
export default {

View File

@ -3,8 +3,10 @@ import { mount } from '@vue/test-utils';
import MockDate from 'mockdate';
import dayjs from 'dayjs';
import antd from 'ant-design-vue';
import utc from 'dayjs/plugin/utc';
import { sleep } from '../utils';
dayjs.extend(utc);
export default function demoTest(component, options = {}) {
const suffix = options.suffix || 'vue';
const files = glob.sync(`./components/${component}/demo/*.${suffix}`);
@ -18,7 +20,7 @@ export default function demoTest(component, options = {}) {
testMethod = test.skip;
}
testMethod(`renders ${file} correctly`, async () => {
MockDate.set(dayjs('2016-11-22'));
MockDate.set(dayjs.utc('2016-11-22').valueOf());
const demo = require(`../.${file}`).default || require(`../.${file}`);
document.body.innerHTML = '';
const wrapper = mount(demo, { global: { plugins: [antd] }, attachTo: document.body });