From 639b746ba55f1ac980fcb8c6fa7fc88a9e06cc35 Mon Sep 17 00:00:00 2001 From: tangjinzhou <415800467@qq.com> Date: Mon, 31 Oct 2022 10:46:36 +0800 Subject: [PATCH] test: update test --- components/menu/__tests__/index.test.js | 9 +-------- components/upload/__tests__/uploadlist.test.js | 16 +++++++--------- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/components/menu/__tests__/index.test.js b/components/menu/__tests__/index.test.js index 25653543e..15cf5ec2e 100644 --- a/components/menu/__tests__/index.test.js +++ b/components/menu/__tests__/index.test.js @@ -124,7 +124,7 @@ describe('Menu', () => { }); it('horizontal', async () => { - const wrapper = mount( + mount( { props: { openKeys: { @@ -150,13 +150,6 @@ describe('Menu', () => { ); await sleep(100); 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 () => { diff --git a/components/upload/__tests__/uploadlist.test.js b/components/upload/__tests__/uploadlist.test.js index 52cd2fff1..063667877 100644 --- a/components/upload/__tests__/uploadlist.test.js +++ b/components/upload/__tests__/uploadlist.test.js @@ -63,7 +63,7 @@ describe('Upload List', () => { }); // 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 = [ { uid: 0, @@ -91,14 +91,12 @@ describe('Upload List', () => { sync: false, }; const wrapper = mount(Upload, props); - setTimeout(async () => { - expect(wrapper.findAll('.ant-upload-list-item').length).toBe(2); - wrapper.findAll('.ant-upload-list-item')[0].find('.anticon-delete').trigger('click'); - await delay(400); - // wrapper.update(); - expect(wrapper.findAll('.ant-upload-list-item').length).toBe(1); - done(); - }, 0); + await sleep(); + expect(wrapper.findAll('.ant-upload-list-item').length).toBe(2); + wrapper.findAll('.ant-upload-list-item')[0].find('.anticon-delete').trigger('click'); + await sleep(400); + // wrapper.update(); + expect(wrapper.findAll('.ant-upload-list-item').length).toBe(1); }); xit('should be uploading when upload a file', done => {