feat(PullRefresh): add pull-distance prop (#8280)

This commit is contained in:
neverland
2021-03-04 20:41:53 +08:00
committed by GitHub
parent d54ba516f3
commit 6d8ed45608
5 changed files with 38 additions and 6 deletions
@@ -1,5 +1,19 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`should allow to custom pull distance 1`] = `
<div class="van-pull-refresh">
<div class="van-pull-refresh__track"
style="transition-duration: 0ms; transform: translate3d(0,100px, 0);"
>
<div class="van-pull-refresh__head">
<div class="van-pull-refresh__text">
Pull to refresh...
</div>
</div>
</div>
</div>
`;
exports[`should render different head content in different pulling status 1`] = `
<div class="van-pull-refresh">
<div class="van-pull-refresh__track"
+14
View File
@@ -150,3 +150,17 @@ test('should set height when using head-height', async () => {
const head = wrapper.find('.van-pull-refresh__head');
expect(head.style.height).toEqual('100px');
});
test('should allow to custom pull distance', async () => {
const wrapper = mount(PullRefresh, {
props: {
pullDistance: 300,
},
});
const track = wrapper.find('.van-pull-refresh__track');
trigger(track, 'touchstart', 0, 0);
trigger(track, 'touchmove', 0, 100);
await later();
expect(wrapper.html()).toMatchSnapshot();
});