diff --git a/webapp/components/Notification/Notification.spec.js b/webapp/components/Notification/Notification.spec.js index 750f59b3a..060154a70 100644 --- a/webapp/components/Notification/Notification.spec.js +++ b/webapp/components/Notification/Notification.spec.js @@ -167,6 +167,7 @@ describe('Notification', () => { 'notifications.reason.mentioned_in_comment', ) }) + it('renders title', () => { wrapper = Wrapper() expect(wrapper.text()).toContain("It's a post title") @@ -198,4 +199,71 @@ describe('Notification', () => { }) }) }) + + describe('given a notification about the user has filed a report', () => { + beforeEach(() => { + propsData.notification = { + reason: 'filed_report_on_resource', + from: { + __typename: 'Report', + id: 'reportOnUser', + filed: [ + { + reasonCategory: 'discrimination_etc', + reasonDescription: 'This user is harassing me with bigoted remarks!', + reportedResource: { + __typename: 'User', + id: 'badWomen', + slug: 'mrs.-badwomen', + name: 'Mrs. Badwomen', + }, + }, + ], + }, + } + }) + + it('renders reason', () => { + wrapper = Wrapper() + expect(wrapper.find('.reason-text-for-test').text()).toEqual( + 'notifications.reason.filed_report_on_resource.user', + ) + }) + + it('renders title', () => { + wrapper = Wrapper() + expect(wrapper.text()).toContain('Mrs. Badwomen') + }) + + it('renders the identifier "notifications.filedReport.category"', () => { + wrapper = Wrapper() + expect(wrapper.text()).toContain('notifications.filedReport.category') + }) + + it('renders the identifier "notifications.filedReport.description"', () => { + wrapper = Wrapper() + expect(wrapper.text()).toContain('notifications.filedReport.description') + }) + + it('renders the users slug', () => { + wrapper = Wrapper() + expect(wrapper.text()).toContain('@mrs.-badwomen') + }) + + it('has no class "read"', () => { + wrapper = Wrapper() + expect(wrapper.classes()).not.toContain('read') + }) + + describe('that is read', () => { + beforeEach(() => { + propsData.notification.read = true + wrapper = Wrapper() + }) + + it('has class "read"', () => { + expect(wrapper.classes()).toContain('read') + }) + }) + }) }) diff --git a/webapp/components/NotificationList/NotificationList.vue b/webapp/components/NotificationList/NotificationList.vue index 5641d8829..fd2d6366c 100644 --- a/webapp/components/NotificationList/NotificationList.vue +++ b/webapp/components/NotificationList/NotificationList.vue @@ -25,7 +25,6 @@ export default { }, methods: { markAsRead(notificationSourceId) { - // Wolle console.log('markAsRead !!! notificationSourceId: ', notificationSourceId) this.$emit('markAsRead', notificationSourceId) }, },