Give the test more sence

This commit is contained in:
Wolfgang Huß 2019-09-23 12:15:46 +02:00
parent da5c63e97d
commit d1444619ab
2 changed files with 18 additions and 4 deletions

View File

@ -79,12 +79,26 @@ describe('NotificationMenu.vue', () => {
},
},
},
{
id: 'notification-43',
read: true,
post: {
id: 'post-3',
title: 'red post title',
contentExcerpt: 'this is yet another post content',
author: {
id: 'john-1',
slug: 'john-doe',
name: 'John Doe',
},
},
},
],
}
}
})
it('displays the total number of notifications', () => {
it('displays the unred number of notifications', () => {
wrapper = Wrapper()
expect(wrapper.find('ds-button-stub').text()).toEqual('2')
})

View File

@ -5,7 +5,7 @@
@click.prevent="updateNotifications"
>
<ds-button class="notifications-menu" disabled icon="bell">
{{ unreadNotifications }}
{{ unredNotifications }}
</ds-button>
</div>
<dropdown v-else class="notifications-menu" :placement="placement">
@ -18,7 +18,7 @@
updateNotifications()
"
>
{{ unreadNotifications }}
{{ unredNotifications }}
</ds-button>
</template>
<template slot="popover">
@ -104,7 +104,7 @@ export default {
totalNotifications() {
return (this.notifications || []).length
},
unreadNotifications() {
unredNotifications() {
let countUnread = 0
if (this.notifications) {
this.notifications.forEach(notification => {