diff --git a/webapp/components/notifications/NotificationMenu.spec.js b/webapp/components/notifications/NotificationMenu.spec.js
index 62b631073..e5d5539f8 100644
--- a/webapp/components/notifications/NotificationMenu.spec.js
+++ b/webapp/components/notifications/NotificationMenu.spec.js
@@ -8,50 +8,20 @@ const localVue = createLocalVue()
localVue.use(Styleguide)
localVue.filter('truncate', string => string)
-config.stubs['dropdown'] = ''
+config.stubs['dropdown'] = ''
describe('NotificationMenu.vue', () => {
let wrapper
let Wrapper
let mocks
let data
-
beforeEach(() => {
mocks = {
$t: jest.fn()
}
data = () => {
return {
- notifications: [
- {
- id: 'notification-41',
- read: false,
- post: {
- id: 'post-1',
- title: 'some post title',
- contentExcerpt: 'this is a post content',
- author: {
- id: 'john-1',
- slug: 'john-doe',
- name: 'John Doe'
- }
- }
- },
- {
- id: 'notification-42',
- read: false,
- post: {
- id: 'post-2',
- title: 'another post title',
- contentExcerpt: 'this is yet another post content',
- author: {
- id: 'john-1',
- slug: 'john-doe',
- name: 'John Doe'
- }
- }
- }
- ]
+ notifications: []
}
}
})
@@ -65,12 +35,58 @@ describe('NotificationMenu.vue', () => {
})
}
- beforeEach(() => {
+ it('counter displays 0', () => {
wrapper = Wrapper()
+ expect(wrapper.find('ds-button-stub').text()).toEqual('0')
})
- it('displays the total number of notifications', () => {
- expect(wrapper.find('ds-button-stub').text()).toEqual('2')
+ it('no dropdown is rendered', () => {
+ wrapper = Wrapper()
+ expect(wrapper.contains('.dropdown')).toBe(false)
+ })
+
+ describe('given some notifications', () => {
+ beforeEach(() => {
+ data = () => {
+ return {
+ notifications: [
+ {
+ id: 'notification-41',
+ read: false,
+ post: {
+ id: 'post-1',
+ title: 'some post title',
+ contentExcerpt: 'this is a post content',
+ author: {
+ id: 'john-1',
+ slug: 'john-doe',
+ name: 'John Doe'
+ }
+ }
+ },
+ {
+ id: 'notification-42',
+ read: false,
+ post: {
+ id: 'post-2',
+ title: 'another 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', () => {
+ wrapper = Wrapper()
+ expect(wrapper.find('ds-button-stub').text()).toEqual('2')
+ })
})
})
})
diff --git a/webapp/components/notifications/NotificationMenu.vue b/webapp/components/notifications/NotificationMenu.vue
index a950a62be..2e2cd2d3f 100644
--- a/webapp/components/notifications/NotificationMenu.vue
+++ b/webapp/components/notifications/NotificationMenu.vue
@@ -1,5 +1,15 @@
-