From c15296dc9176ddfe186f50123b5ceedb0d6461da Mon Sep 17 00:00:00 2001 From: alangsto <46360176+alangsto@users.noreply.github.com> Date: Mon, 30 Aug 2021 16:34:16 -0400 Subject: [PATCH] fix: only show masquerade message for time gated content (#42) MST-1012. The masquerading message for exams should only be shown if content is time gated. --- src/exam/Exam.jsx | 2 +- src/exam/ExamWrapper.test.jsx | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/exam/Exam.jsx b/src/exam/Exam.jsx index 78831587..5ccaa6db 100644 --- a/src/exam/Exam.jsx +++ b/src/exam/Exam.jsx @@ -38,7 +38,7 @@ const Exam = ({ isTimeLimited, originalUserIsStaff, children }) => { const shouldShowMasqueradeAlert = () => { // if course staff is masquerading as a specific learner, they should be able // to view the exam content regardless of the learner's current state - if (originalUserIsStaff) { + if (originalUserIsStaff && isTimeLimited) { if (examType === ExamType.TIMED && passedDueDate && !hideAfterDue) { // if the learner is able to view exam content after the due date is passed, // don't show this alert diff --git a/src/exam/ExamWrapper.test.jsx b/src/exam/ExamWrapper.test.jsx index a97fcf24..c8ac46f3 100644 --- a/src/exam/ExamWrapper.test.jsx +++ b/src/exam/ExamWrapper.test.jsx @@ -212,4 +212,17 @@ describe('SequenceExamWrapper', () => { expect(queryByTestId('sequence-content')).toHaveTextContent('children'); expect(queryByTestId('masquerade-alert')).not.toBeInTheDocument(); }); + + it('does not display masquerade alert if sequence is not time gated', () => { + const { queryByTestId } = render( + + +
children
+
+
, + { store }, + ); + expect(queryByTestId('sequence-content')).toHaveTextContent('children'); + expect(queryByTestId('masquerade-alert')).not.toBeInTheDocument(); + }); });