mirror of
https://gitee.com/ElemeFE/element.git
synced 2024-12-03 04:39:09 +08:00
Tab: add test
This commit is contained in:
parent
9e0afd3835
commit
3473dc47a4
60
test/unit/specs/tag.spec.js
Normal file
60
test/unit/specs/tag.spec.js
Normal 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;
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue
Block a user