Tab: add test

This commit is contained in:
Sabrina Luo 2016-10-20 18:34:59 +08:00
parent 9e0afd3835
commit 3473dc47a4

View File

@ -0,0 +1,60 @@
import { createVue } from '../util';
describe('Tag', () => {
it('create', () => {
const vm = createVue({
template: `
<el-tag></el-tag>
`
}, true);
expect(vm.$el.classList.contains('el-tag')).to.be.true;
expect(vm.$el.classList.contains('el-tag__close')).to.be.false;
expect(vm.$el.classList.contains('is-hit')).to.be.false;
expect(vm.$el.classList.contains('md-fade-center')).to.be.false;
});
it('text', () => {
const vm = createVue({
template: `
<el-tag>标签</el-tag>
`
}, true);
expect(vm.$el.textContent.length).to.be.at.least(2);
});
it('type', () => {
const vm = createVue({
template: `
<el-tag type="primary"></el-tag>
`
}, true);
expect(vm.$el.classList.contains('el-tag--primary')).to.be.true;
});
it('hit', () => {
const vm = createVue({
template: `
<el-tag hit="true"></el-tag>
`
}, true);
expect(vm.$el.classList.contains('is-hit')).to.be.true;
});
it('closable', () => {
const vm = createVue({
template: `
<el-tag closable="true"></el-tag>
`
}, true);
expect(vm.$el.querySelector('.el-tag .el-tag__close')).to.exist;
});
it('closeTransition', () => {
const vm = createVue({
template: `
<el-tag closable="true" closeTransition="true"></el-tag>
`
}, true);
expect(vm.$el.classList.contains('md-fade-center')).to.be.false;
});
});