From be6c73745264fccef140451d76f949e0ad7508c4 Mon Sep 17 00:00:00 2001 From: Raphael Beer Date: Wed, 26 Feb 2020 14:03:11 +0100 Subject: [PATCH 001/106] Change: render link to /notifications when no new notifications --- .../NotificationMenu/NotificationMenu.spec.js | 23 ++++++++++++------- .../NotificationMenu/NotificationMenu.vue | 8 ++++--- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/webapp/components/NotificationMenu/NotificationMenu.spec.js b/webapp/components/NotificationMenu/NotificationMenu.spec.js index 8020c8bb4..2f6227810 100644 --- a/webapp/components/NotificationMenu/NotificationMenu.spec.js +++ b/webapp/components/NotificationMenu/NotificationMenu.spec.js @@ -1,4 +1,4 @@ -import { config, mount } from '@vue/test-utils' +import { config, mount, RouterLinkStub } from '@vue/test-utils' import NotificationMenu from './NotificationMenu' const localVue = global.localVue @@ -11,6 +11,7 @@ describe('NotificationMenu.vue', () => { let wrapper let mocks let data + let stubs beforeEach(() => { mocks = { $t: jest.fn(), @@ -20,6 +21,9 @@ describe('NotificationMenu.vue', () => { notifications: [], } } + stubs = { + NuxtLink: RouterLinkStub + } }) describe('mount', () => { @@ -28,12 +32,14 @@ describe('NotificationMenu.vue', () => { data, mocks, localVue, + stubs }) } - it('counter displays 0', () => { + it('renders as link without counter', () => { wrapper = Wrapper() - expect(wrapper.find('.count').text()).toEqual('0') + expect(wrapper.is('a.notifications-menu')).toBe(true) + expect(() => wrapper.get('.count')).toThrow() }) it('no dropdown is rendered', () => { @@ -41,7 +47,7 @@ describe('NotificationMenu.vue', () => { expect(wrapper.contains('.dropdown')).toBe(false) }) - describe('given only unread notifications', () => { + describe('given only read notifications', () => { beforeEach(() => { data = () => { return { @@ -65,14 +71,15 @@ describe('NotificationMenu.vue', () => { } }) - it('counter displays 0', () => { + it('renders as link without counter', () => { wrapper = Wrapper() - expect(wrapper.find('.count').text()).toEqual('0') + expect(wrapper.is('a.notifications-menu')).toBe(true) + expect(() => wrapper.get('.count')).toThrow() }) - it('counter is not colored', () => { + it('no dropdown is rendered', () => { wrapper = Wrapper() - expect(wrapper.find('.count').classes()).toContain('--inactive') + expect(wrapper.contains('.dropdown')).toBe(false) }) }) diff --git a/webapp/components/NotificationMenu/NotificationMenu.vue b/webapp/components/NotificationMenu/NotificationMenu.vue index d00ab2837..4d780c374 100644 --- a/webapp/components/NotificationMenu/NotificationMenu.vue +++ b/webapp/components/NotificationMenu/NotificationMenu.vue @@ -1,7 +1,9 @@