Skip to content

Commit 2d03466

Browse files
committed
test: update snap
1 parent b2b27ae commit 2d03466

File tree

8 files changed

+18
-15
lines changed

8 files changed

+18
-15
lines changed

components/image/__tests__/__snapshots__/demo.test.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ exports[`renders ./components/image/demo/fallback.vue correctly 1`] = `
1919
exports[`renders ./components/image/demo/placeholder.vue correctly 1`] = `
2020
<div class="ant-space ant-space-horizontal ant-space-align-center">
2121
<div class="ant-space-item" style="margin-right: 12px;">
22-
<div class="ant-image" style="width: 200px;"><img class="ant-image-img" src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png?1479744000000">
22+
<div class="ant-image" style="width: 200px;"><img class="ant-image-img" src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png?1479772800000">
2323
<div aria-hidden="true" class="ant-image-placeholder">
2424
<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">
2525
<!---->

components/table/__tests__/Table.pagination.test.js

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -76,17 +76,14 @@ describe('Table.pagination', () => {
7676
});
7777
});
7878

79-
it('paginate data', done => {
79+
it('paginate data', async () => {
8080
const wrapper = mount(Table, getTableOptions());
81-
Vue.nextTick(() => {
82-
expect(renderedNames(wrapper)).toEqual(['Jack', 'Lucy']);
83-
const pager = wrapper.findAllComponents({ name: 'Pager' });
84-
pager.at(pager.length - 1).trigger('click');
85-
Vue.nextTick(() => {
86-
expect(renderedNames(wrapper)).toEqual(['Tom', 'Jerry']);
87-
done();
88-
});
89-
});
81+
await sleep();
82+
expect(renderedNames(wrapper)).toEqual(['Jack', 'Lucy']);
83+
const pager = wrapper.findAllComponents({ name: 'Pager' });
84+
pager.at(pager.length - 1).trigger('click');
85+
await sleep();
86+
expect(renderedNames(wrapper)).toEqual(['Tom', 'Jerry']);
9087
});
9188

9289
it('repaginates when pageSize change', () => {

components/table/__tests__/Table.rowSelection.test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ describe('Table.rowSelection', () => {
260260
expect(handleSelectInvert).toBeCalledWith([1, 2, 3]);
261261
});
262262

263-
it('fires selection event', () => {
263+
it('fires selection event', async () => {
264264
const handleSelectOdd = jest.fn();
265265
const handleSelectEven = jest.fn();
266266
const rowSelection = {
@@ -289,6 +289,7 @@ describe('Table.rowSelection', () => {
289289
},
290290
{ sync: false },
291291
);
292+
await sleep();
292293
expect(dropdownWrapper.findAll('.ant-dropdown-menu-item').length).toBe(4);
293294

294295
dropdownWrapper.findAll('.ant-dropdown-menu-item')[2].trigger('click');
@@ -399,6 +400,7 @@ describe('Table.rowSelection', () => {
399400
dataSource: newData,
400401
}),
401402
);
403+
await sleep();
402404
const pager = wrapper.findAllComponents({ name: 'Pager' });
403405
pager.at(pager.length - 1).trigger('click'); // switch to second page
404406
wrapper.findAll('input')[0].element.checked = true;

components/time-picker/__tests__/__snapshots__/demo.test.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ exports[`renders ./components/time-picker/demo/value.vue correctly 1`] = `
147147
<p>Do not change</p>
148148
<!---->
149149
<div class="ant-picker">
150-
<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>
150+
<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>
151151
</div>
152152
</div>
153153
`;

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@
188188
"prettier": "^2.2.0",
189189
"pretty-quick": "^3.0.0",
190190
"prismjs": "^1.23.0",
191+
"query-string": "^7.0.1",
191192
"querystring": "^0.2.0",
192193
"raw-loader": "^4.0.2",
193194
"reqwest": "^2.0.5",

site/src/router/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable import/no-unresolved */
12
import Layout from '../layouts/index.vue';
23
import Iframe from '../layouts/Iframe.vue';
34
// import Iframe from '../components/iframe.jsx';

site/src/views/user/login/model.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import router from '../../../router';
21
import { parse } from 'query-string';
2+
import router from '../../../router';
33
import { fakeAccountLogin } from './service';
44

55
export default {

tests/shared/demoTest.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ import { mount } from '@vue/test-utils';
33
import MockDate from 'mockdate';
44
import dayjs from 'dayjs';
55
import antd from 'ant-design-vue';
6+
import utc from 'dayjs/plugin/utc';
67
import { sleep } from '../utils';
78

9+
dayjs.extend(utc);
810
export default function demoTest(component, options = {}) {
911
const suffix = options.suffix || 'vue';
1012
const files = glob.sync(`./components/${component}/demo/*.${suffix}`);
@@ -18,7 +20,7 @@ export default function demoTest(component, options = {}) {
1820
testMethod = test.skip;
1921
}
2022
testMethod(`renders ${file} correctly`, async () => {
21-
MockDate.set(dayjs('2016-11-22'));
23+
MockDate.set(dayjs.utc('2016-11-22').valueOf());
2224
const demo = require(`../.${file}`).default || require(`../.${file}`);
2325
document.body.innerHTML = '';
2426
const wrapper = mount(demo, { global: { plugins: [antd] }, attachTo: document.body });

0 commit comments

Comments
 (0)