feat(Overlay): add lock-scroll prop (#6082)

This commit is contained in:
neverland
2020-04-18 08:33:41 +08:00
committed by GitHub
parent 2abc2f939e
commit 8f3baa3449
4 changed files with 43 additions and 10 deletions
+26
View File
@@ -70,3 +70,29 @@ test('default slot', () => {
expect(wrapper).toMatchSnapshot();
});
test('lock-scroll prop', () => {
const onTouchMove = jest.fn();
const wrapper = mount({
template: `
<div @touchmove="onTouchMove">
<van-overlay :lock-scroll="lockScroll" />
</div>
`,
data() {
return {
lockScroll: true,
};
},
methods: {
onTouchMove,
},
});
wrapper.find('.van-overlay').trigger('touchmove');
expect(onTouchMove).toHaveBeenCalledTimes(0);
wrapper.setData({ lockScroll: false });
wrapper.find('.van-overlay').trigger('touchmove');
expect(onTouchMove).toHaveBeenCalledTimes(1);
});