[new feature] Uploader: support click to preview image (#3603)

This commit is contained in:
neverland
2019-06-22 14:57:58 +08:00
committed by GitHub
parent d690c5548d
commit a27df2c25f
3 changed files with 32 additions and 5 deletions

View File

@@ -257,3 +257,24 @@ it('delete preview image', async () => {
expect(wrapper).toMatchSnapshot();
expect(wrapper.emitted('delete')[0]).toBeTruthy();
});
it('click to preview image', async () => {
const wrapper = mount(Uploader, {
propsData: {
fileList: [],
previewSize: 30
},
listeners: {
input(fileList) {
wrapper.setProps({ fileList });
}
}
});
wrapper.vm.onChange(file);
await later();
wrapper.find('.van-image').trigger('click');
expect(document.querySelector('.van-image-preview')).toBeTruthy();
});