mirror of
https://github.com/youzan/vant.git
synced 2025-10-20 02:31:21 +00:00
[new feature] CellSwipe support async controll (#356)
* fix: Tabbar icon line-height * [new feature] progress add showPivot prop * [new feature] TabItem support vue-router * [new feature] update document header style * [Doc] add toast english ducoment * [bugfix] Search box-sizing wrong * [Doc] update vant-demo respo * [Doc] translate theme & demo pages * [Doc] add Internationalization document * [bugfix] remove unnecessary props * [fix] optimize clickoutside * [new feature] optimize find-parent * [new feature]: change document title accordinng to language * [new feature] Pagination code review * [improvement] adjust icon-font unicode * [improvement] Icon spinner color inherit * [improvement] icon default width * [bugfix] DateTimePicker validate date props * [bugfix] Tab item text ellipsis * [improvement] optimize single line ellipsis * [Improvement] optimzie staticClass * [Improvement] Button: use sfc instread of jsx * [Improvement] update actionsheet close icon style * fix: yarn.lock * fix: icon test cases * [bugfix] errors during ssr * [Improvement] SubmitBar add left slot * [new feature] ImagePreview support manually close * fix: ImagePreview test case * [Doc] add switch lang button in mobile * [bugfix] Popup overlay style update * [bugfix] NavBar click event * [Improvement] optimize build speed * [new feature] CellSwipe support async controll
This commit is contained in:
@@ -27,7 +27,7 @@ describe('CellSwipe', () => {
|
||||
expect(wrapper.find('.van-cell-swipe__right').length).to.equal(0);
|
||||
});
|
||||
|
||||
it('drag and show left part', () => {
|
||||
it('drag and show left part', done => {
|
||||
wrapper = mount(CellSwipe, defaultProps);
|
||||
|
||||
triggerTouch(wrapper, 'touchstart', 0, 0);
|
||||
@@ -41,10 +41,11 @@ describe('CellSwipe', () => {
|
||||
expect(wrapper.vm.offset).to.equal(100);
|
||||
wrapper.vm.$nextTick(() => {
|
||||
expect(wrapper.vm.opened).to.be.true;
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('drag and show right part', () => {
|
||||
it('drag and show right part', done => {
|
||||
wrapper = mount(CellSwipe, defaultProps);
|
||||
|
||||
triggerTouch(wrapper, 'touchstart', 0, 0);
|
||||
@@ -53,6 +54,9 @@ describe('CellSwipe', () => {
|
||||
expect(wrapper.vm.offset).to.equal(-100);
|
||||
wrapper.vm.$nextTick(() => {
|
||||
expect(wrapper.vm.opened).to.be.true;
|
||||
wrapper.trigger('click');
|
||||
expect(wrapper.vm.offset).to.equal(0);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -114,4 +118,37 @@ describe('CellSwipe', () => {
|
||||
triggerTouch(wrapper, 'touchend', 0, 100);
|
||||
expect(wrapper.vm.offset).to.equal(0);
|
||||
});
|
||||
|
||||
it('on close prop', () => {
|
||||
let clickPosition;
|
||||
let instance;
|
||||
const onClose = (position, ins) => {
|
||||
clickPosition = position;
|
||||
instance = ins;
|
||||
};
|
||||
|
||||
wrapper = mount(CellSwipe, {
|
||||
propsData: {
|
||||
...defaultProps.propsData,
|
||||
onClose
|
||||
}
|
||||
});
|
||||
|
||||
wrapper.trigger('click');
|
||||
wrapper.vm.onClick();
|
||||
expect(clickPosition).to.equal(undefined);
|
||||
|
||||
wrapper.vm.offset = 100;
|
||||
wrapper.trigger('click');
|
||||
expect(clickPosition).to.equal('cell');
|
||||
|
||||
wrapper.find('.van-cell-swipe__left')[0].trigger('click');
|
||||
expect(clickPosition).to.equal('left');
|
||||
|
||||
wrapper.find('.van-cell-swipe__right')[0].trigger('click');
|
||||
expect(clickPosition).to.equal('right');
|
||||
|
||||
instance.close();
|
||||
expect(wrapper.vm.offset).to.equal(0);
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user