diff --git a/components/button/__test__/__snapshots__/index.test.md b/components/button/__test__/__snapshots__/index.test.md index 66b89200a..7112e1edd 100644 --- a/components/button/__test__/__snapshots__/index.test.md +++ b/components/button/__test__/__snapshots__/index.test.md @@ -6,3 +6,23 @@ "" ``` +#### `should support link button` + +``` +"" +``` + +#### `fixbug renders {0} , 0 and {false}` + +``` +"" +``` + +``` +"" +``` + +``` +"" +``` + diff --git a/components/button/__test__/index.spec.js b/components/button/__test__/index.spec.js index 4f8d974d2..b1b6cff85 100644 --- a/components/button/__test__/index.spec.js +++ b/components/button/__test__/index.spec.js @@ -56,5 +56,85 @@ describe('Button', () => { done() }) }) + it('should change loading state instantly by default', () => { + const DefaultButton = { + data(){ + return { + loading: false, + } + }, + methods: { + enterLoading () { + this.loading = true + } + }, + + render() { + return ; + } + } + const wrapper = mount(DefaultButton) + wrapper.trigger('click'); + Vue.nextTick(() => { + expect(wrapper.find('.ant-btn-loading').length).to.equal(1); + }) + }); + + it('should change loading state with delay', () => { + const DefaultButton = { + data(){ + return { + loading: false, + } + }, + methods: { + enterLoading () { + this.loading = { delay: 1000 } + } + }, + + render() { + return ; + } + } + const wrapper = mount(DefaultButton) + wrapper.trigger('click'); + Vue.nextTick(() => { + expect(wrapper.hasClass('ant-btn-loading').length).to.equal(false); + }) + }); + + it('should support link button', () => { + const wrapper = mount({ + render (h) { + return + }, + }) + expect(wrapper.html()).to.matchSnapshot(); + }) + + it('fixbug renders {0} , 0 and {false}', () => { + const wrapper = mount({ + render (h) { + return + }, + }) + expect(wrapper.html()).to.matchSnapshot(); + + const wrapper1 = mount({ + render (h) { + return + }, + }) + expect(wrapper1.html()).to.matchSnapshot(); + + const wrapper2 = mount({ + render (h) { + return + }, + }) + expect(wrapper2.html()).to.matchSnapshot(); + + }) }) diff --git a/package.json b/package.json index 5f580b39f..4bac8288e 100644 --- a/package.json +++ b/package.json @@ -146,10 +146,12 @@ "stylelint-config-standard": "^17.0.0", "through2": "^2.0.3", "validate-commit-msg": "^2.14.0", + "vue": "^2.5.16", "vue-antd-md-loader": "^1.0.3", "vue-clipboard2": "0.0.8", "vue-loader": "^13.0.5", "vue-router": "^3.0.1", + "vue-template-compiler": "^2.5.16", "webpack": "^3.11.0", "webpack-chunk-hash": "^0.5.0", "webpack-dev-server": "^2.8.2",