Skip to content

Commit

Permalink
fix: only show masquerade message for time gated content (#42)
Browse files Browse the repository at this point in the history
MST-1012. The masquerading message for exams should only be shown if content is time gated.
  • Loading branch information
alangsto authored Aug 30, 2021
1 parent c043b71 commit c15296d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/exam/Exam.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions src/exam/ExamWrapper.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
});

0 comments on commit c15296d

Please sign in to comment.