feat(Swipe): add prev、next method (#5548)

This commit is contained in:
neverland
2020-01-10 17:51:34 +08:00
committed by GitHub
parent d023fda8cb
commit 2d6f633c7a
4 changed files with 59 additions and 24 deletions
+15 -2
View File
@@ -43,7 +43,7 @@ const Component = {
}
};
test('swipeTo', async () => {
test('swipeTo method', async () => {
const wrapper = mount(Component);
const { swipe } = wrapper.vm.$refs;
swipe.swipeTo(2);
@@ -52,7 +52,7 @@ test('swipeTo', async () => {
expect(swipe.active).toEqual(2);
});
test('swipeTo immediate', async () => {
test('swipeTo method with immediate option', async () => {
const wrapper = mount(Component);
const { swipe } = wrapper.vm.$refs;
swipe.swipeTo(2, {
@@ -63,6 +63,19 @@ test('swipeTo immediate', async () => {
expect(swipe.active).toEqual(2);
});
test('prev and next method', async () => {
const wrapper = mount(Component);
const { swipe } = wrapper.vm.$refs;
swipe.next();
await later(50);
expect(swipe.active).toEqual(1);
swipe.prev();
await later(50);
expect(swipe.active).toEqual(0);
});
test('initial swipe', () => {
const wrapper = mount(Component);
const { swipe } = wrapper.vm.$refs;