mirror of
https://github.com/youzan/vant.git
synced 2025-10-18 01:17:15 +00:00
[new feature] Cell support vue-router target route (#268)
* [bugfix] CouponList always show empty info * [bugfix] add click feedback of buttons in components * [Doc] add custom theme document * [new feature] Notice bar support more props * [bugfix] PullRefresh test cases * [bugfix] unused NoticeBar style * [bugfix] Swipe width calc error * [Doc] english document of all action components * [Doc] change document site path to /zanui/vant * [Doc] fix * [bugfix] uploader style error * [bugfix] tabs document demo * [new feature] Cell support vue-router target route * [bugfix] add cell test cases * update yarn.lock
This commit is contained in:
@@ -49,4 +49,46 @@ describe('Cell', () => {
|
||||
expect(eventStub.calledOnce).to.be.true;
|
||||
expect(eventStub.calledWith('click')).to.be.true;
|
||||
});
|
||||
|
||||
it('cell with url', () => {
|
||||
wrapper = mount(Cell, {
|
||||
propsData: {
|
||||
url: '#test',
|
||||
replace: false
|
||||
}
|
||||
});
|
||||
|
||||
wrapper.trigger('click');
|
||||
|
||||
expect(window.location.hash).to.equal('#test');
|
||||
window.location.hash = '';
|
||||
|
||||
const length = window.history.length;
|
||||
wrapper.vm.replace = true;
|
||||
wrapper.trigger('click');
|
||||
expect(window.location.hash).to.equal('#test');
|
||||
expect(window.history.length).to.equal(length);
|
||||
window.location.hash = '';
|
||||
});
|
||||
|
||||
it('cell with to', done => {
|
||||
wrapper = mount(Cell, {
|
||||
propsData: {
|
||||
to: '/test',
|
||||
replace: false
|
||||
}
|
||||
});
|
||||
wrapper.vm.$router = {
|
||||
push(path) {
|
||||
wrapper.vm.replace = true;
|
||||
wrapper.trigger('click');
|
||||
},
|
||||
replace(path) {
|
||||
expect(path).to.equal('/test');
|
||||
done();
|
||||
}
|
||||
};
|
||||
|
||||
wrapper.trigger('click');
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user