Skip to content

Commit 49fad05

Browse files
committed
chore(tests)
completed code coverage
1 parent 43f86e2 commit 49fad05

File tree

7 files changed

+489
-11
lines changed

7 files changed

+489
-11
lines changed

src/components/Toast.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<div v-else>{{toast.body}}</div>
1111
</div>
1212
</div>
13-
<div class=" toast-close-button" v-if="toast.showCloseButton" v-on:click="onClick(toast, $event, true)"
13+
<div class="toast-close-button" v-if="toast.showCloseButton" v-on:click="onClick(toast, $event, true)"
1414
v-html="toast.toastConfig.closeHtml">
1515
</div>
1616
</div>

src/install.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
import ToastContainer from './components/ToastContainer.vue'
2+
import ToastService from './services/toastService'
3+
import Constants from './utils/constants'
24
import {
35
installBus
46
} from './services/toastServiceBus'
57

6-
import ToastService from './services/toastService'
7-
8-
import Constants from './utils/constants'
9-
108
export let _Vue
119

1210
export function install(Vue) {
@@ -22,13 +20,14 @@ export function install(Vue) {
2220

2321
Vue.component('ToastContainer', ToastContainer)
2422

25-
Vue.prototype.$vue2toaster = {
23+
Vue.prototype.$vueOnToast = {
2624
pop: ToastService.pop,
2725
remove: ToastService.remove,
2826
Constants
2927
}
3028
}
3129

30+
/* istanbul ignore if */
3231
if (typeof window !== 'undefined' && window.Vue) {
3332
window.Vue.use(install)
3433
}

src/services/toastService.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ export default {
2020
body: body
2121
} : type
2222

23-
toast.toastId = Guid.newGuid()
24-
25-
if (!toast.type || !toast.type.length) {
23+
if (!toast || !toast.type || !toast.type.length) {
2624
throw new Error('A toast type must be provided')
2725
}
2826

@@ -31,6 +29,8 @@ export default {
3129
'No Toaster Containers have been initialized to receive toasts.')
3230
}
3331

32+
toast.toastId = Guid.newGuid()
33+
3434
ToastServiceBus.$emit(Constants.ADD_TOAST, toast)
3535

3636
return toast

test/unit/specs/Install.spec.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,7 @@ describe('Install.js', () => {
1010

1111
expect(Vue.options.components.ToastContainer).to.be.defined
1212
expect(Object.keys(Vue.options.components).length).to.equal(4)
13+
14+
install.install(Vue)
1315
})
1416
})

0 commit comments

Comments
 (0)