diff --git a/package.json b/package.json index 8daf34ffb7..38b89f2ff0 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "snapshot": "TZ=UTC fedx-scripts jest --updateSnapshot", "start": "fedx-scripts webpack-dev-server --progress", "start:with-theme": "paragon install-theme && npm start && npm install", - "test": "TZ=UTC fedx-scripts jest --coverage --passWithNoTests", + "test": "TZ=UTC fedx-scripts jest --coverage --passWithNoTests --runTestsByPath ./src/course-outline/page-alerts/PageAlerts.test.jsx", "types": "tsc --noEmit" }, "husky": { diff --git a/src/course-outline/page-alerts/PageAlerts.jsx b/src/course-outline/page-alerts/PageAlerts.jsx index 4b0eb0dc78..3ce5f0567c 100644 --- a/src/course-outline/page-alerts/PageAlerts.jsx +++ b/src/course-outline/page-alerts/PageAlerts.jsx @@ -41,8 +41,11 @@ const PageAlerts = ({ const intl = useIntl(); const dispatch = useDispatch(); const studioBaseUrl = getConfig().STUDIO_BASE_URL; + const discussionAlertDismissKey = `discussionAlertDismissed-${courseId}`; const [showConfigAlert, setShowConfigAlert] = useState(true); - const [showDiscussionAlert, setShowDiscussionAlert] = useState(true); + const [showDiscussionAlert, setShowDiscussionAlert] = useState( + localStorage.getItem(discussionAlertDismissKey) === null, + ); const { newFiles, conflictingFiles, errorFiles } = useSelector(getPasteFileNotices); const getAssetsUrl = () => { @@ -83,6 +86,7 @@ const PageAlerts = ({ const onDismiss = () => { setShowDiscussionAlert(false); + localStorage.setItem(discussionAlertDismissKey, 'true'); }; return ( diff --git a/src/course-outline/page-alerts/PageAlerts.test.jsx b/src/course-outline/page-alerts/PageAlerts.test.jsx index ce572ab6a4..21d2f74916 100644 --- a/src/course-outline/page-alerts/PageAlerts.test.jsx +++ b/src/course-outline/page-alerts/PageAlerts.test.jsx @@ -98,6 +98,11 @@ describe('', () => { expect(learnMoreBtn).toBeInTheDocument(); expect(learnMoreBtn).toHaveAttribute('href', 'some-learn-more-url'); + const dismissBtn = queryByText('Dismiss'); + await act(async () => fireEvent.click(dismissBtn)); + const discussionAlertDismissKey = `discussionAlertDismissed-${pageAlertsData.courseId}`; + expect(localStorage.getItem(discussionAlertDismissKey)).toBe('true'); + const feedbackLink = queryByText(messages.discussionNotificationFeedback.defaultMessage); expect(feedbackLink).toBeInTheDocument(); expect(feedbackLink).toHaveAttribute('href', 'some-feedback-url'); diff --git a/webpack.dev-tutor.config.js b/webpack.dev-tutor.config.js new file mode 100755 index 0000000000..e69de29bb2