[new feature] ImagePreview: add asyncClose prop (#2198)

This commit is contained in:
neverland
2018-12-01 09:35:34 +08:00
committed by GitHub
parent 1b1e5caa19
commit 00fe13d800
6 changed files with 44 additions and 14 deletions

View File

@@ -39,6 +39,22 @@ test('render image', () => {
expect(wrapper.emitted('input')[0][0]).toBeFalsy();
});
test('async close', () => {
const wrapper = mount(ImagePreviewVue, {
propsData: {
images,
value: true,
asyncClose: true
}
});
const swipe = wrapper.find('.van-swipe__track');
triggerDrag(swipe, 0, 0);
expect(wrapper.emitted('input')).toBeFalsy();
wrapper.vm.close();
expect(wrapper.emitted('input')[0][0]).toBeFalsy();
});
test('function call', done => {
ImagePreview(images);
ImagePreview(images.slice(0, 1));