[new feature] ImagePreview: add closeOnPopstate prop

This commit is contained in:
陈嘉涵
2019-05-24 20:13:50 +08:00
parent 30ddcb5daa
commit b572c76245
7 changed files with 53 additions and 2 deletions
+21
View File
@@ -116,3 +116,24 @@ test('index slot', () => {
expect(wrapper).toMatchSnapshot();
});
test('closeOnPopstate', () => {
const wrapper = mount(ImagePreviewVue, {
propsData: {
images,
value: true,
closeOnPopstate: true
}
});
trigger(window, 'popstate');
expect(wrapper.emitted('input')[0][0]).toBeFalsy();
wrapper.setProps({
value: true,
closeOnPopstate: false
});
trigger(window, 'popstate');
expect(wrapper.emitted('input')[1]).toBeFalsy();
});