Skip to content

Commit

Permalink
fix(CSU-Booking-Platform#425): fix remove last file submit crashes wh…
Browse files Browse the repository at this point in the history
…en uploading

Signed-off-by: Dan Seremet <dan_seremet@yahoo.com>
  • Loading branch information
danseremet authored and Alex committed Mar 15, 2021
1 parent 9315b20 commit 7401efb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions resources/js/Components/Form/SortableUpload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ import createFileList from "create-file-list";
files.splice(index, 1);
this.files = createFileList(files);
if (!this.files?.length) {
this.files = [];
}
this.$emit("change", this.files);
},
drop(e) {
Expand Down
12 changes: 12 additions & 0 deletions tests/Javascript/Components/Form/SortableUpload.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ beforeEach(() => {
size: 2267483,
type: "application/pdf",
webkitRelativePath: "",
},{
lastModified: 1610336108413,
name: "Sprint 6 Review.pdf",
size: 2267483,
type: "application/pdf",
webkitRelativePath: "",
}],
}
}
Expand Down Expand Up @@ -83,6 +89,12 @@ test('should change when remove', () => {
wrapper.vm.remove(1);

expect(wrapper.emitted().change).toBeTruthy();

wrapper.vm.remove(1);
expect(wrapper.emitted().change).toBeTruthy();

wrapper.vm.remove(1);
expect(wrapper.emitted().change).toBeTruthy();
})

test('should change when drop', () => {
Expand Down

0 comments on commit 7401efb

Please sign in to comment.