mirror of
https://gitee.com/ElemeFE/element.git
synced 2024-12-01 11:47:41 +08:00
tag test improve (#552)
This commit is contained in:
parent
febe6e8ffa
commit
831f72bbeb
@ -34,25 +34,41 @@ describe('Tag', () => {
|
|||||||
it('hit', () => {
|
it('hit', () => {
|
||||||
const vm = createVue({
|
const vm = createVue({
|
||||||
template: `
|
template: `
|
||||||
<el-tag hit="true"></el-tag>
|
<el-tag hit></el-tag>
|
||||||
`
|
`
|
||||||
}, true);
|
}, true);
|
||||||
expect(vm.$el.classList.contains('is-hit')).to.be.true;
|
expect(vm.$el.classList.contains('is-hit')).to.be.true;
|
||||||
});
|
});
|
||||||
|
|
||||||
it('closable', () => {
|
it('closable', done => {
|
||||||
const vm = createVue({
|
const vm = createVue({
|
||||||
template: `
|
template: `
|
||||||
<el-tag closable="true"></el-tag>
|
<el-tag closable @close="handleClose">关闭标签</el-tag>
|
||||||
`
|
`,
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
isClose: false
|
||||||
|
};
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleClose() {
|
||||||
|
this.isClose = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}, true);
|
}, true);
|
||||||
expect(vm.$el.querySelector('.el-tag .el-tag__close')).to.exist;
|
var closeBtn = vm.$el.querySelector('.el-tag .el-tag__close');
|
||||||
|
expect(closeBtn).to.exist;
|
||||||
|
closeBtn.click();
|
||||||
|
vm.$nextTick(_ => {
|
||||||
|
expect(vm.isClose).to.true;
|
||||||
|
done();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('closeTransition', () => {
|
it('closeTransition', () => {
|
||||||
const vm = createVue({
|
const vm = createVue({
|
||||||
template: `
|
template: `
|
||||||
<el-tag closable="true" closeTransition="true"></el-tag>
|
<el-tag closable closeTransition></el-tag>
|
||||||
`
|
`
|
||||||
}, true);
|
}, true);
|
||||||
expect(vm.$el.classList.contains('md-fade-center')).to.be.false;
|
expect(vm.$el.classList.contains('md-fade-center')).to.be.false;
|
||||||
|
Loading…
Reference in New Issue
Block a user