[new feature] ActionSheet: add close-on-click-action prop

This commit is contained in:
陈嘉涵
2019-05-05 16:43:12 +08:00
parent 8afcb1e14a
commit 0288fb35a4
5 changed files with 47 additions and 11 deletions
+21
View File
@@ -64,3 +64,24 @@ test('get container', () => {
expect(wrapper.vm.$el.parentNode).toEqual(document.body);
});
test('close-on-click-action prop', () => {
const onInput = jest.fn();
const wrapper = mount(ActionSheet, {
propsData: {
value: true,
actions: [{ name: 'Option' }],
closeOnClickAction: true
},
context: {
on: {
input: onInput
}
}
});
const option = wrapper.find('.van-action-sheet__item');
option.trigger('click');
expect(onInput).toHaveBeenCalledWith(false);
});