From 0bb2b905eeaeff5283ed53968dab8d964bfd9fb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Wed, 22 Jan 2020 13:32:54 +0100 Subject: [PATCH] Add example notification for filed report to storybook --- webapp/components/NotificationList/NotificationList.spec.js | 4 ++-- .../components/NotificationsTable/NotificationsTable.spec.js | 3 ++- .../components/NotificationsTable/NotificationsTable.story.js | 2 ++ webapp/components/utils/Notifications.js | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/webapp/components/NotificationList/NotificationList.spec.js b/webapp/components/NotificationList/NotificationList.spec.js index e3b9815b2..03f3cfe2d 100644 --- a/webapp/components/NotificationList/NotificationList.spec.js +++ b/webapp/components/NotificationList/NotificationList.spec.js @@ -3,7 +3,7 @@ import NotificationList from './NotificationList' import Notification from '../Notification/Notification' import Vuex from 'vuex' -import { notifications } from '~/components/utils/Notifications' +import { testNotifications } from '~/components/utils/Notifications' const localVue = global.localVue @@ -34,7 +34,7 @@ describe('NotificationList.vue', () => { stubs = { NuxtLink: RouterLinkStub, } - propsData = { notifications } + propsData = { notifications: testNotifications } }) describe('shallowMount', () => { diff --git a/webapp/components/NotificationsTable/NotificationsTable.spec.js b/webapp/components/NotificationsTable/NotificationsTable.spec.js index 18fa0c930..2be92357c 100644 --- a/webapp/components/NotificationsTable/NotificationsTable.spec.js +++ b/webapp/components/NotificationsTable/NotificationsTable.spec.js @@ -3,7 +3,7 @@ import { config, mount, RouterLinkStub } from '@vue/test-utils' import Vuex from 'vuex' import NotificationsTable from './NotificationsTable' -import { notifications } from '~/components/utils/Notifications' +import { testNotifications } from '~/components/utils/Notifications' const localVue = global.localVue localVue.filter('truncate', string => string) @@ -12,6 +12,7 @@ config.stubs['client-only'] = '' describe('NotificationsTable.vue', () => { let wrapper, mocks, propsData, stubs + const notifications = testNotifications const postNotification = notifications[0] const commentNotification = notifications[1] const reportNotification = notifications[2] diff --git a/webapp/components/NotificationsTable/NotificationsTable.story.js b/webapp/components/NotificationsTable/NotificationsTable.story.js index 84deb31c9..4243c3112 100644 --- a/webapp/components/NotificationsTable/NotificationsTable.story.js +++ b/webapp/components/NotificationsTable/NotificationsTable.story.js @@ -1,6 +1,7 @@ import { storiesOf } from '@storybook/vue' import { withA11y } from '@storybook/addon-a11y' import { action } from '@storybook/addon-actions' +import { testNotifications } from '~/components/utils/Notifications' import NotificationsTable from '~/components/NotificationsTable/NotificationsTable' import helpers from '~/storybook/helpers' import { post } from '~/components/PostCard/PostCard.story.js' @@ -61,6 +62,7 @@ export const notifications = [ __typename: 'NOTIFIED', index: 2, }, + ...testNotifications, ] storiesOf('NotificationsTable', module) .addDecorator(withA11y) diff --git a/webapp/components/utils/Notifications.js b/webapp/components/utils/Notifications.js index f54df1793..0a022f1ac 100644 --- a/webapp/components/utils/Notifications.js +++ b/webapp/components/utils/Notifications.js @@ -1,4 +1,4 @@ -export const notifications = [ +export const testNotifications = [ { read: false, reason: 'mentioned_in_post',