Skip to content

Commit 7d106fb

Browse files
author
Diego Jara
committed
update class name to BEM style
1 parent 2829844 commit 7d106fb

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/Avatar.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
2-
<div><div class="avatar" :style="style">
2+
<div class="vue-avatar--wrapper" :class="customClass" :style="style">
33
<span v-if="!this.src">{{ userInitial }}</span>
4-
</div></div>
4+
</div>
55
</template>
66

77
<script>
@@ -21,6 +21,9 @@ export default {
2121
color: {
2222
type: String
2323
},
24+
customClass: {
25+
type: String
26+
},
2427
size: {
2528
type: Number,
2629
default: 50

test/unit/specs/Avatar.spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ describe('Avatar.vue', function () {
3636

3737
var initial = vm.$children[0].initial(username)
3838
expect(initial).to.equal('HF')
39-
expect(vm.$el.querySelector('.avatar > span').textContent).to.contain(initial)
39+
expect(vm.$el.querySelector('.vue-avatar--wrapper > span').textContent).to.contain(initial)
4040
})
4141

4242
it('should render an image with the correct \'src\' when given', function () {
@@ -51,8 +51,8 @@ describe('Avatar.vue', function () {
5151
expect(initial).to.equal('HF')
5252

5353
/* eslint-disable no-unused-expressions */
54-
expect(vm.$el.querySelector('.avatar > span')).to.be.null
55-
var av = vm.$el.querySelector('.avatar')
54+
expect(vm.$el.querySelector('.vue-avatar--wrapper > span')).to.be.null
55+
var av = vm.$el.querySelector('.vue-avatar--wrapper')
5656
var background = av.style.background // window.getComputedStyle(av,null).width
5757
expect(background).to.contain('path/to/img')
5858
})

0 commit comments

Comments
 (0)