Badge: fix type class when is-dot (#21308)

pull/21255/head^2
Aex 2021-09-16 16:17:16 +08:00 committed by GitHub
parent 95445e209f
commit 492ab00ad7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View File

@ -7,7 +7,7 @@
v-text="content" v-text="content"
class="el-badge__content" class="el-badge__content"
:class="[ :class="[
'el-badge__content--' + type, type ? 'el-badge__content--' + type : null,
{ {
'is-fixed': $slots.default, 'is-fixed': $slots.default,
'is-dot': isDot 'is-dot': isDot

View File

@ -32,6 +32,17 @@ describe('Badge', () => {
expect(vm.$el.querySelector('.el-badge__content.is-dot')).to.exist; expect(vm.$el.querySelector('.el-badge__content.is-dot')).to.exist;
}); });
it('is dot with type', () => {
vm = createVue(`
<el-badge is-dot type="success">
<button>click</button>
</el-badge>
`);
expect(vm.$el.querySelector('.el-badge__content.is-dot')).to.exist;
expect(vm.$el.querySelector('.el-badge__content.el-badge__content--success.is-dot')).to.exist;
});
it('max', () => { it('max', () => {
vm = createTest(Badge, { max: 100, value: 200 }); vm = createTest(Badge, { max: 100, value: 200 });
expect(vm.content).to.equal('100+'); expect(vm.content).to.equal('100+');