forked from instructure/canvas-lms
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add originality report visibility settings
Closes PLAT-2779 Test Plan: - Create an assignment with a plagiarism detection tool associated. Set the 'Show originality report to students' to 'Never'. - Create an originality report for a submission and verify it is not visible to the student on the submission details page or grades summary page. It should still be visible to the teacher. - Edit the assignment and change the visibility option to 'After the due date'. Also set the due date to a date/time in the past. - Verify the originality report is now visible to the student in the submission details page and grade summary page (note that you may need to flush redis). - Create a new assignment associated with a plagiarism detection tool and set the visibility option to 'After the assignment is graded'. - Create a submission and an originality report. - Verify that the student cannot view the originality report until the assignment has been graded by the teacher. - Edit the assignment and change report visibility to Immediately. Verify that the student can still view the originality report. Change-Id: I35a4e87275577b5b5d9cc0c1ce3501a5ae048a79 Reviewed-on: https://gerrit.instructure.com/123766 Reviewed-by: Andrew Butterfield <[email protected]> QA-Review: August Thornton <[email protected]> Tested-by: Jenkins Product-Review: Jesse Poulos <[email protected]>
- Loading branch information
Showing
10 changed files
with
237 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/* | ||
* Copyright (C) 2017 - present Instructure, Inc. | ||
* | ||
* This file is part of Canvas. | ||
* | ||
* Canvas is free software: you can redistribute it and/or modify it under | ||
* the terms of the GNU Affero General Public License as published by the Free | ||
* Software Foundation, version 3 of the License. | ||
* | ||
* Canvas is distributed in the hope that it will be useful, but WITHOUT ANY | ||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | ||
* A PARTICULAR PURPOSE. See the GNU Affero General Public License for more | ||
* details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License along | ||
* with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
import I18n from 'i18n!assignments' | ||
|
||
export default class OriginalityReportVisibilityPicker extends React.Component { | ||
static propTypes = { | ||
isEnabled: PropTypes.bool.isRequired, | ||
selectedOption: PropTypes.string | ||
}; | ||
|
||
static defaultProps = { | ||
selectedOption: null | ||
}; | ||
|
||
constructor(props) { | ||
super(props); | ||
this.state = { | ||
selectedOption: props.selectedOption | ||
}; | ||
} | ||
|
||
setSelectedOption = (e) => { | ||
this.setState({selectedOption: e.target.value}); | ||
} | ||
|
||
render() { | ||
return ( | ||
<div> | ||
<hr /> | ||
<label id="report_visibility_picker_label" htmlFor="report_visibility_picker_select"> | ||
{I18n.t('Show originality report to students')} | ||
</label> | ||
<div id="report_visibility_picker"> | ||
<select | ||
id="report_visibility_picker_select" | ||
name="report_visibility" | ||
ref={(c) => { this.visibilityPicker = c; }} | ||
disabled={!this.props.isEnabled} | ||
value={this.state.selectedOption} | ||
onChange={this.setSelectedOption} | ||
> | ||
<option title={I18n.t('Immediately')} value="immediate" > | ||
{I18n.t('Immediately')} | ||
</option> | ||
<option title={I18n.t('After the assignment is graded')} value="after_grading"> | ||
{I18n.t('After the assignment is graded')} | ||
</option> | ||
<option title={I18n.t('After the due date')} value="after_due_date"> | ||
{I18n.t('After the due date')} | ||
</option> | ||
<option title={I18n.t('Never')} value="never"> | ||
{I18n.t('Never')} | ||
</option> | ||
</select> | ||
</div> | ||
</div> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
spec/javascripts/jsx/assignments/OriginalityReportVisibilityPickerSpec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/* | ||
* Copyright (C) 2017 - present Instructure, Inc. | ||
* | ||
* This file is part of Canvas. | ||
* | ||
* Canvas is free software: you can redistribute it and/or modify it under | ||
* the terms of the GNU Affero General Public License as published by the Free | ||
* Software Foundation, version 3 of the License. | ||
* | ||
* Canvas is distributed in the hope that it will be useful, but WITHOUT ANY | ||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | ||
* A PARTICULAR PURPOSE. See the GNU Affero General Public License for more | ||
* details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License along | ||
* with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
import $ from 'jquery' | ||
import React from 'react' | ||
import { mount } from 'enzyme' | ||
import OriginalityReportVisibilityPicker from 'jsx/assignments/OriginalityReportVisibilityPicker' | ||
|
||
QUnit.module('OriginalityReportVisibilityPicker', { | ||
setup () {} | ||
}); | ||
|
||
test('it renders', () => { | ||
const wrapper = mount( | ||
<OriginalityReportVisibilityPicker | ||
isEnabled={true} | ||
selectedOption='immediate' | ||
/> | ||
); | ||
ok(wrapper.exists()); | ||
}); | ||
|
||
test('it renders "immediate" option', () => { | ||
const wrapper = mount( | ||
<OriginalityReportVisibilityPicker | ||
isEnabled={true} | ||
selectedOption='immediate' | ||
/> | ||
); | ||
ok(wrapper.find("option[value='immediate']")); | ||
}); | ||
|
||
test('it renders "after_grading" option', () => { | ||
const wrapper = mount( | ||
<OriginalityReportVisibilityPicker | ||
isEnabled={true} | ||
selectedOption='immediate' | ||
/> | ||
); | ||
ok(wrapper.find("option[value='after_grading']")); | ||
}); | ||
|
||
test('it renders "after_due_date" option', () => { | ||
const wrapper = mount( | ||
<OriginalityReportVisibilityPicker | ||
isEnabled={true} | ||
selectedOption='immediate' | ||
/> | ||
); | ||
ok(wrapper.find("option[value='after_due_date']")); | ||
}); | ||
|
||
test('it renders "never" option', () => { | ||
const wrapper = mount( | ||
<OriginalityReportVisibilityPicker | ||
isEnabled={true} | ||
selectedOption='immediate' | ||
/> | ||
); | ||
ok(wrapper.find("option[value='never']")); | ||
}); | ||
|
||
test('it selects the "selectedOption"', () => { | ||
const wrapper = mount( | ||
<OriginalityReportVisibilityPicker | ||
isEnabled={true} | ||
selectedOption='after_due_date' | ||
/> | ||
); | ||
ok(wrapper.find('#report_visibility_picker_select').node.value, 'after_due_date') | ||
}); |