diff --git a/packages/web-components/src/components/va-file-input-multiple/test/va-file-input-multiple.e2e.ts b/packages/web-components/src/components/va-file-input-multiple/test/va-file-input-multiple.e2e.ts index 1a54bb894..e14e17592 100644 --- a/packages/web-components/src/components/va-file-input-multiple/test/va-file-input-multiple.e2e.ts +++ b/packages/web-components/src/components/va-file-input-multiple/test/va-file-input-multiple.e2e.ts @@ -107,6 +107,8 @@ describe('va-file-input-multiple', () => { await input .uploadFile(filePath) .catch(e => console.log('uploadFile error', e)); + + await page.waitForChanges(); expect(fileUploadSpy).toHaveReceivedEventTimes(1); }); diff --git a/packages/web-components/src/components/va-file-input/va-file-input.tsx b/packages/web-components/src/components/va-file-input/va-file-input.tsx index eeb438d77..85fcb4093 100644 --- a/packages/web-components/src/components/va-file-input/va-file-input.tsx +++ b/packages/web-components/src/components/va-file-input/va-file-input.tsx @@ -145,7 +145,7 @@ export class VaFileInput { } }; - private handleFile = (file: File) => { + private handleFile = (file: File, emitChange: boolean = true) => { if (this.accept) { const normalizedAcceptTypes = this.normalizeAcceptProp(this.accept); if (!this.isAcceptedFileType(file.type, normalizedAcceptTypes)) { @@ -156,7 +156,9 @@ export class VaFileInput { } this.file = file; - this.vaChange.emit({ files: [this.file] }); + if (emitChange) { + this.vaChange.emit({ files: [this.file] }); + } this.uploadStatus = 'success'; this.internalError = null; this.generateFileContents(this.file); @@ -356,7 +358,7 @@ export class VaFileInput { } = this; if (value) { - this.handleFile(value); + this.handleFile(value, false); } const displayError = this.error || this.internalError;