From 9e1d99659ab04d53448399f6ba002c10995fa06e Mon Sep 17 00:00:00 2001 From: Lone Iversen <108085781+loivsen@users.noreply.github.com> Date: Tue, 24 Sep 2024 12:18:06 +0200 Subject: [PATCH] timeouts --- .../uui-file-dropzone/lib/uui-file-dropzone.test.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/uui-file-dropzone/lib/uui-file-dropzone.test.ts b/packages/uui-file-dropzone/lib/uui-file-dropzone.test.ts index 4f0484071..4187bfb63 100644 --- a/packages/uui-file-dropzone/lib/uui-file-dropzone.test.ts +++ b/packages/uui-file-dropzone/lib/uui-file-dropzone.test.ts @@ -8,7 +8,7 @@ function expectFileChangeEvent( numberOfFolders: number, done: Mocha.Done, ) { - return element.addEventListener('change', e => { + element.addEventListener('change', e => { const { files, folders } = (e as UUIFileDropzoneEvent).detail; expect( files.length, @@ -18,7 +18,7 @@ function expectFileChangeEvent( folders.length, `There should be ${numberOfFolders} folder(s) uploaded`, ).to.equal(numberOfFolders); - return done(); + done(); }); } @@ -41,6 +41,7 @@ describe('UUIFileDropzoneElement', () => { describe('drop files', async () => { it('supports dropping a single file', async done => { + setTimeout(() => done(), 5000); const file1 = new File([''], 'file1.txt', { type: 'text/plain' }); const file2 = new File([''], 'file2.txt', { type: 'text/plain' }); const dataTransfer = new DataTransfer(); @@ -58,11 +59,11 @@ describe('UUIFileDropzoneElement', () => { }); it('can drop multiple files', done => { - element.multiple = true; - + setTimeout(() => done(), 5000); const file1 = new File([''], 'file1.txt', { type: 'text/plain' }); const file2 = new File([''], 'file2.txt', { type: 'text/plain' }); const dataTransfer = new DataTransfer(); + element.multiple = true; if ('items' in dataTransfer) { dataTransfer.items.add(file1); dataTransfer.items.add(file2); @@ -74,6 +75,7 @@ describe('UUIFileDropzoneElement', () => { }); it('can set the accept attribute with a mimetype', done => { + setTimeout(() => done(), 5000); const file1 = new File([''], 'file1.jpg', { type: 'image/jpeg' }); const file2 = new File([''], 'file2.txt', { type: 'text/plain' }); const dataTransfer = new DataTransfer(); @@ -119,6 +121,7 @@ describe('UUIFileDropzoneElement', () => { }); it('supports selecting a single file', done => { + setTimeout(() => done(), 5000); const file1 = new File([''], 'file1.txt', { type: 'text/plain' }); const file2 = new File([''], 'file2.txt', { type: 'text/plain' }); const dt = new DataTransfer(); @@ -136,6 +139,7 @@ describe('UUIFileDropzoneElement', () => { }); it('can select multiple files', done => { + setTimeout(() => done(), 5000); const file1 = new File([''], 'file1.txt', { type: 'text/plain' }); const file2 = new File([''], 'file2.txt', { type: 'text/plain' }); const dt = new DataTransfer();