Skip to content

Commit

Permalink
Merge 232326d into 59261f5
Browse files Browse the repository at this point in the history
  • Loading branch information
baiyaaaaa authored Oct 20, 2016
2 parents 59261f5 + 232326d commit 544bf92
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions test/unit/specs/tag.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,41 @@ describe('Tag', () => {
it('hit', () => {
const vm = createVue({
template: `
<el-tag hit="true"></el-tag>
<el-tag hit></el-tag>
`
}, true);
expect(vm.$el.classList.contains('is-hit')).to.be.true;
});

it('closable', () => {
it('closable', done => {
const vm = createVue({
template: `
<el-tag closable="true"></el-tag>
`
<el-tag closable @close="handleClose">关闭标签</el-tag>
`,
data() {
return {
isClose: false
};
},
methods: {
handleClose() {
this.isClose = 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', () => {
const vm = createVue({
template: `
<el-tag closable="true" closeTransition="true"></el-tag>
<el-tag closable closeTransition></el-tag>
`
}, true);
expect(vm.$el.classList.contains('md-fade-center')).to.be.false;
Expand Down

0 comments on commit 544bf92

Please sign in to comment.