[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:
neverland
2017-10-30 05:39:32 -05:00
committed by GitHub
parent ed43b21306
commit 16fe6b2e6d
6 changed files with 135 additions and 116 deletions

View File

@@ -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');
});
});