diff --git a/src/color-picker/src/ColorPickerSwatches.tsx b/src/color-picker/src/ColorPickerSwatches.tsx index 160eaeaa9..b91eab5b5 100644 --- a/src/color-picker/src/ColorPickerSwatches.tsx +++ b/src/color-picker/src/ColorPickerSwatches.tsx @@ -105,7 +105,7 @@ export default defineComponent({ class={`${clsPrefix}-color-picker-swatch`} tabindex={0} onClick={() => this.handleSwatchSelect(swatch)} - onKeydown={e => this.handleSwatchKeyDown(e, swatch)} + onKeydown={(e) => this.handleSwatchKeyDown(e, swatch)} >
{ mount(NLoadingBarProvider) }) - it('should have start type', () => { + it('should have start type', (done) => { const Test = defineComponent({ setup () { const loadingBar = useLoadingBar() @@ -26,17 +26,21 @@ describe('n-loading-bar', () => { const wrapper = mount(() => ( {{ default: () => }} )) - void nextTick(() => { + setTimeout(() => { expect(document.querySelector('.n-loading-bar')).not.toEqual(null) wrapper.unmount() - }) + done() + }, 0) }) - it('should have finish type', async () => { + + it('should have finish type', (done) => { const Test = defineComponent({ setup () { const loadingBar = useLoadingBar() loadingBar.start() - loadingBar.finish() + setTimeout(() => { + loadingBar.finish() + }, 0) }, render () { return null @@ -45,14 +49,16 @@ describe('n-loading-bar', () => { const wrapper = mount(() => ( {{ default: () => }} )) - await nextTick() - expect(document.querySelector('.n-loading-bar--finishing')).not.toEqual( - null - ) - wrapper.unmount() + setTimeout(() => { + expect(document.querySelector('.n-loading-bar--finishing')).not.toEqual( + null + ) + wrapper.unmount() + done() + }, 0) }) - it('should have error type', async () => { + it('should have error type', () => { const Test = defineComponent({ setup () { const loadingBar = useLoadingBar() @@ -65,14 +71,10 @@ describe('n-loading-bar', () => { const wrapper = mount(() => ( {{ default: () => }} )) - await nextTick(() => { - setTimeout(() => { - expect(document.querySelector('.n-loading-bar--error')).not.toEqual( - null - ) - wrapper.unmount() - }, 300) - }) + setTimeout(() => { + expect(document.querySelector('.n-loading-bar--error')).not.toEqual(null) + wrapper.unmount() + }, 0) }) it('should have loadingBarStyle prop', (done) => { @@ -98,14 +100,12 @@ describe('n-loading-bar', () => { default: () => } }) - void nextTick(() => { - setTimeout(() => { - expect( - document.querySelector('.n-loading-bar--error')?.getAttribute('style') - ).toContain('height: 5px;') - wrapper.unmount() - done() - }, 300) - }) + setTimeout(() => { + expect( + document.querySelector('.n-loading-bar--error')?.getAttribute('style') + ).toContain('height: 5px;') + wrapper.unmount() + done() + }, 0) }) })