Skip to content

Commit

Permalink
timeouts
Browse files Browse the repository at this point in the history
  • Loading branch information
loivsen committed Sep 24, 2024
1 parent 394903b commit 9e1d996
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/uui-file-dropzone/lib/uui-file-dropzone.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -18,7 +18,7 @@ function expectFileChangeEvent(
folders.length,
`There should be ${numberOfFolders} folder(s) uploaded`,
).to.equal(numberOfFolders);
return done();
done();
});
}

Expand All @@ -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();
Expand All @@ -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);
Expand All @@ -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();
Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand Down

0 comments on commit 9e1d996

Please sign in to comment.