From 08358c89eb013068e07200663217c56c5d807ebf Mon Sep 17 00:00:00 2001 From: neverland Date: Fri, 28 Jun 2019 16:03:10 +0800 Subject: [PATCH] [new feature] SwipeCell: add name prop (#3680) --- src/swipe-cell/README.md | 14 ++++++++------ src/swipe-cell/README.zh-CN.md | 14 +++++++++----- src/swipe-cell/demo/index.vue | 2 +- src/swipe-cell/index.js | 8 ++++++-- src/swipe-cell/test/index.spec.js | 19 ++++++++++++++++++- 5 files changed, 42 insertions(+), 15 deletions(-) diff --git a/src/swipe-cell/README.md b/src/swipe-cell/README.md index e8e975cfe..ab747df02 100644 --- a/src/swipe-cell/README.md +++ b/src/swipe-cell/README.md @@ -13,7 +13,7 @@ Vue.use(SwipeCell); ### Basic Usage ```html - + + + + { expect(wrapper).toMatchSnapshot(); }); -it('on close prop', () => { +it('on-close prop', () => { let position; let instance; @@ -72,6 +72,23 @@ it('on close prop', () => { expect(wrapper.vm.offset).toEqual(0); }); +it('name prop', done => { + const wrapper = mount(SwipeCell, { + ...defaultProps, + propsData: { + ...defaultProps.propsData, + name: 'test', + onClose(position, instance, detail) { + expect(detail.name).toEqual('test'); + done(); + } + } + }); + + wrapper.vm.open('left'); + wrapper.trigger('click'); +}); + it('should reset after drag', () => { const wrapper = mount(SwipeCell, defaultProps);