From 5f9e8cc59d933423d30628067c3375be93a1a37a Mon Sep 17 00:00:00 2001
From: tangjinzhou <415800467@qq.com>
Date: Mon, 23 Apr 2018 18:46:11 +0800
Subject: [PATCH] test: update button test
---
components/button/__test__/index.spec.js | 56 ++++++++++++++++++++----
1 file changed, 47 insertions(+), 9 deletions(-)
diff --git a/components/button/__test__/index.spec.js b/components/button/__test__/index.spec.js
index 2ae83ea52..ee16a65e9 100644
--- a/components/button/__test__/index.spec.js
+++ b/components/button/__test__/index.spec.js
@@ -1,18 +1,56 @@
import Button from '../index'
-import {mount} from 'avoriaz'
+import Icon from '../../icon'
+import { mount } from 'avoriaz'
+import Vue from 'vue'
describe('Button', () => {
- let wrapper
-
- afterEach(() => {
- wrapper && wrapper.destroy()
- })
it('create primary button', () => {
- wrapper = mount(Button, {
- propsData: {
- type: 'primary',
+ const wrapper = mount({
+ render (h) {
+ return
},
})
expect(wrapper.hasClass('ant-btn-primary')).to.equal(true)
})
+ it('renders Chinese characters correctly', (done) => {
+ const wrapper = mount(
+ {
+ render (h) {
+ return
+ },
+ }
+ )
+ expect(wrapper.text()).to.equal('按 钮')
+
+ const wrapper1 = mount(
+ {
+ render (h) {
+ return
+ },
+ }
+ )
+ expect(wrapper1.text()).to.equal('按钮')
+
+ const wrapper2 = mount(
+ {
+ render (h) {
+ return
+ },
+ }
+ )
+ expect(wrapper2.text()).to.equal('按钮')
+
+ const wrapper3 = mount(
+ {
+ render (h) {
+ return
+ },
+ }
+ )
+ Vue.nextTick(() => {
+ expect(wrapper3.find('.ant-btn')[0].hasClass('ant-btn-two-chinese-chars')).to.equal(true);
+ done()
+ })
+ })
+
})