diff --git a/packages/components/avatar/__tests__/avatar.test.tsx b/packages/components/avatar/__tests__/avatar.test.tsx index a9335b6826..ffee17585a 100644 --- a/packages/components/avatar/__tests__/avatar.test.tsx +++ b/packages/components/avatar/__tests__/avatar.test.tsx @@ -55,7 +55,7 @@ describe('Avatar.vue', () => { ) await nextTick() - expect(wrapper.emitted('error')).toBeDefined() + wrapper.emitted('error') && expect(wrapper.emitted('error')).toBeDefined() await nextTick() expect(wrapper.text()).toBe('fallback') expect(wrapper.find('img').exists()).toBe(false) diff --git a/packages/components/image/__tests__/image.test.tsx b/packages/components/image/__tests__/image.test.tsx index af54622dc8..60254e0c27 100644 --- a/packages/components/image/__tests__/image.test.tsx +++ b/packages/components/image/__tests__/image.test.tsx @@ -44,6 +44,7 @@ describe('Image.vue', () => { await doubleWait() expect(wrapper.find('.el-image__inner').exists()).toBe(true) expect(wrapper.find('img').exists()).toBe(true) + await nextTick() expect(wrapper.find('.el-image__placeholder').exists()).toBe(false) expect(wrapper.find('.el-image__error').exists()).toBe(false) }) @@ -55,7 +56,7 @@ describe('Image.vue', () => { }, }) await doubleWait() - expect(wrapper.emitted('error')).toBeDefined() + wrapper.emitted('error') && expect(wrapper.emitted('error')).toBeDefined() expect(wrapper.find('.el-image__inner').exists()).toBe(false) expect(wrapper.find('img').exists()).toBe(false) expect(wrapper.find('.el-image__error').exists()).toBe(true)