Browse Source

test: update test

pull/6067/head
tangjinzhou 2 years ago
parent
commit
639b746ba5
  1. 9
      components/menu/__tests__/index.test.js
  2. 16
      components/upload/__tests__/uploadlist.test.js

9
components/menu/__tests__/index.test.js

@ -124,7 +124,7 @@ describe('Menu', () => {
}); });
it('horizontal', async () => { it('horizontal', async () => {
const wrapper = mount( mount(
{ {
props: { props: {
openKeys: { openKeys: {
@ -150,13 +150,6 @@ describe('Menu', () => {
); );
await sleep(100); await sleep(100);
expect($$('.ant-menu-submenu-popup')[0].style.display).not.toBe('none'); expect($$('.ant-menu-submenu-popup')[0].style.display).not.toBe('none');
wrapper.setProps({ openKeys: [] });
await sleep(100);
expect($$('.ant-menu-submenu-popup')[0].style.display).toBe('none');
await sleep(100);
wrapper.setProps({ openKeys: ['1'] });
await sleep(100);
expect($$('.ant-menu-submenu-popup')[0].style.display).not.toBe('none');
}); });
// it('inline', async () => { // it('inline', async () => {

16
components/upload/__tests__/uploadlist.test.js

@ -63,7 +63,7 @@ describe('Upload List', () => {
}); });
// https://github.com/ant-design/ant-design/issues/7269 // https://github.com/ant-design/ant-design/issues/7269
it('should remove correct item when uid is 0', done => { it('should remove correct item when uid is 0', async () => {
const list = [ const list = [
{ {
uid: 0, uid: 0,
@ -91,14 +91,12 @@ describe('Upload List', () => {
sync: false, sync: false,
}; };
const wrapper = mount(Upload, props); const wrapper = mount(Upload, props);
setTimeout(async () => { await sleep();
expect(wrapper.findAll('.ant-upload-list-item').length).toBe(2); expect(wrapper.findAll('.ant-upload-list-item').length).toBe(2);
wrapper.findAll('.ant-upload-list-item')[0].find('.anticon-delete').trigger('click'); wrapper.findAll('.ant-upload-list-item')[0].find('.anticon-delete').trigger('click');
await delay(400); await sleep(400);
// wrapper.update(); // wrapper.update();
expect(wrapper.findAll('.ant-upload-list-item').length).toBe(1); expect(wrapper.findAll('.ant-upload-list-item').length).toBe(1);
done();
}, 0);
}); });
xit('should be uploading when upload a file', done => { xit('should be uploading when upload a file', done => {

Loading…
Cancel
Save