Skip to content

Commit 49b8337

Browse files
feat(drag & drog): test component new behavior
1 parent 1a741b6 commit 49b8337

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

test/components/FileSelector.nuxt.test.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,35 @@ describe("FileSelector.vue", async () => {
5757
files,
5858
})
5959
})
60+
61+
62+
test(`Files prop`, async () => {
63+
registerEndpoint(allowed_files_schema.$id, {
64+
method: allowed_files_schema.methods[0],
65+
handler: () => ({
66+
extensions: ["1", "2", "3"],
67+
}),
68+
})
69+
70+
const files = [new File(["fake_file"], "fake_file.txt")]
71+
72+
const wrapper = await mountSuspended(FileSelector, {
73+
global: {
74+
plugins: [vuetify],
75+
},
76+
props: { multiple: false, supported_feature: "test", files : files },
77+
})
78+
registerEndpoint(upload_file_schema.$id, {
79+
method: upload_file_schema.methods[1],
80+
handler: () => ({}),
81+
})
82+
83+
await flushPromises()
84+
85+
expect(wrapper.emitted()).toHaveProperty("update_values")
86+
expect(wrapper.emitted().update_values).toHaveLength(1)
87+
expect(wrapper.emitted().update_values[0][0]).toEqual({
88+
files,
89+
})
90+
})
6091
})

0 commit comments

Comments
 (0)