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( + <ExamStateProvider> + <SequenceExamWrapper sequence={{ ...sequence, isTimeLimited: false }} courseId={courseId} originalUserIsStaff> + <div data-testid="sequence-content">children</div> + </SequenceExamWrapper> + </ExamStateProvider>, + { store }, + ); + expect(queryByTestId('sequence-content')).toHaveTextContent('children'); + expect(queryByTestId('masquerade-alert')).not.toBeInTheDocument(); + }); });