From 0161b7f16c9cab61c9f433891ab0f610c8668201 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Wed, 5 Feb 2020 12:49:04 +0100 Subject: [PATCH] Implement suggestions of Matt --- webapp/components/Notification/Notification.spec.js | 8 ++++---- webapp/components/Notification/Notification.vue | 7 ++----- .../NotificationsTable/NotificationsTable.spec.js | 10 +++++----- .../NotificationsTable/NotificationsTable.vue | 11 ++++------- webapp/components/UserTeaser/UserTeaser.vue | 4 ++-- 5 files changed, 17 insertions(+), 23 deletions(-) diff --git a/webapp/components/Notification/Notification.spec.js b/webapp/components/Notification/Notification.spec.js index 0569fb3e3..084a32551 100644 --- a/webapp/components/Notification/Notification.spec.js +++ b/webapp/components/Notification/Notification.spec.js @@ -63,7 +63,7 @@ describe('Notification', () => { it('renders reason', () => { wrapper = Wrapper() - expect(wrapper.find('.reason-text-for-test').text()).toEqual( + expect(wrapper.find('[data-test="reason-text"]').text()).toEqual( 'notifications.reason.commented_on_post', ) }) @@ -113,7 +113,7 @@ describe('Notification', () => { it('renders reason', () => { wrapper = Wrapper() - expect(wrapper.find('.reason-text-for-test').text()).toEqual( + expect(wrapper.find('[data-test="reason-text"]').text()).toEqual( 'notifications.reason.mentioned_in_post', ) }) @@ -163,7 +163,7 @@ describe('Notification', () => { it('renders reason', () => { wrapper = Wrapper() - expect(wrapper.find('.reason-text-for-test').text()).toEqual( + expect(wrapper.find('[data-test="reason-text"]').text()).toEqual( 'notifications.reason.mentioned_in_comment', ) }) @@ -225,7 +225,7 @@ describe('Notification', () => { it('renders reason', () => { wrapper = Wrapper() - expect(wrapper.find('.reason-text-for-test').text()).toEqual( + expect(wrapper.find('[data-test="reason-text"]').text()).toEqual( 'notifications.reason.filed_report_on_resource.user', ) }) diff --git a/webapp/components/Notification/Notification.vue b/webapp/components/Notification/Notification.vue index 9ee3512e9..4943ac92f 100644 --- a/webapp/components/Notification/Notification.vue +++ b/webapp/components/Notification/Notification.vue @@ -4,7 +4,7 @@ - + - + { }) it('renders a link to the post', () => { - const postLink = firstRowNotification.find('a.notification-link-for-test') + const postLink = firstRowNotification.find('[data-test="notification-title-link"]') expect(postLink.text()).toEqual(postNotification.from.title) }) @@ -136,7 +136,7 @@ describe('NotificationsTable.vue', () => { }) it('renders a link to the post', () => { - const postLink = secondRowNotification.find('a.notification-link-for-test') + const postLink = secondRowNotification.find('[data-test="notification-title-link"]') expect(postLink.text()).toEqual(commentNotification.from.post.title) }) @@ -153,7 +153,7 @@ describe('NotificationsTable.vue', () => { }) it('renders me as the triggerer', () => { - const triggererName = thirdRowNotification.find('.userName-for-test') + const triggererName = thirdRowNotification.find('[data-test="userName"]') expect(triggererName.text()).toEqual('myName') }) @@ -166,7 +166,7 @@ describe('NotificationsTable.vue', () => { }) it('renders a link to the user', () => { - const userLink = thirdRowNotification.find('a.notification-link-for-test') + const userLink = thirdRowNotification.find('[data-test="notification-title-link"]') expect(userLink.text()).toEqual(reportNotification.from.filed[0].reportedResource.name) }) @@ -204,7 +204,7 @@ describe('NotificationsTable.vue', () => { }) it('clicking on a Post link emits `markNotificationAsRead`', () => { - wrapper.find('a.notification-link-for-test').trigger('click') + wrapper.find('[data-test="notification-title-link"]').trigger('click') expect(wrapper.emitted().markNotificationAsRead[0][0]).toEqual(postNotification.from.id) }) diff --git a/webapp/components/NotificationsTable/NotificationsTable.vue b/webapp/components/NotificationsTable/NotificationsTable.vue index d7ee6d381..288337a11 100644 --- a/webapp/components/NotificationsTable/NotificationsTable.vue +++ b/webapp/components/NotificationsTable/NotificationsTable.vue @@ -40,8 +40,7 @@