feat(Popover): add click-overlay event (#8050)

This commit is contained in:
neverland
2021-01-31 18:43:18 +08:00
committed by GitHub
parent d27626ada2
commit 63227201ff
4 changed files with 30 additions and 14 deletions
+15
View File
@@ -148,3 +148,18 @@ test('should close popover when touch outside content', async () => {
trigger(document.body, 'touchstart');
expect(wrapper.emitted('update:show')[0][0]).toEqual(false);
});
test('should emit click-overlay event when overlay is clicked', () => {
const onClickOverlay = jest.fn();
const wrapper = mount(Popover, {
props: {
show: true,
overlay: true,
teleport: null,
onClickOverlay,
},
});
wrapper.find('.van-overlay').trigger('click');
expect(onClickOverlay).toHaveBeenCalledTimes(1);
});