import Button from '../index' import Icon from '../../icon' import { mount } from 'avoriaz' import Vue from 'vue' import { matchSnapshot } from "chai-karma-snapshot"; import { use, expect, assert } from "chai"; use(matchSnapshot); describe('Button', () => { it('create primary button', () => { const wrapper = mount({ render (h) { return }, }) expect(wrapper.html()).to.matchSnapshot(); 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() }) }) })