update moderation page "post grades" language
closes GRADE-2260 test plan: A. Setup 1. Setup a course with AMM 2. Add a moderated assignment with: a. Two graders (A and B) b. A third, final grader (C) 3. Ensure enrollment of at least 1 student * fewer takes less time for QA 4. Assign some provisional grades using graders A and B 5. Log in as the final grader C B. Verify, Part 1 1. Visit the moderation page for the assignment 2. Select grades for each student 3. Verify the "Release Grades" button uses that language 4. Click the "Release Grades" button 5. Verify the "Release Grades" changes labels to: a. "Releasing Grades" b. then "Grades Released" C. Verify, Part 2 1. Verify the "Post to Students" button uses that language 2. Click the "Post to Students" button 3. Verify the "Post to Students" changes labels to: a. "Posting to Students" b. then "Grades Posted to Students" Change-Id: I60cad30f24396f321d6349c7124ccd90321ab785 Reviewed-on: https://gerrit.instructure.com/201589 Tested-by: Jenkins Reviewed-by: Gary Mei <gmei@instructure.com> Reviewed-by: Adrian Packel <apackel@instructure.com> Reviewed-by: Derek Bender <djbender@instructure.com> QA-Review: Jeremy Neander <jneander@instructure.com> Product-Review: Jonathan Fenton <jfenton@instructure.com>
This commit is contained in:
parent
a897338853
commit
5032b3e5ed
|
@ -19,16 +19,16 @@
|
|||
import * as AssignmentApi from './AssignmentApi'
|
||||
|
||||
export const FAILURE = 'FAILURE'
|
||||
export const GRADES_ALREADY_PUBLISHED = 'GRADES_ALREADY_PUBLISHED'
|
||||
export const GRADES_ALREADY_RELEASED = 'GRADES_ALREADY_RELEASED'
|
||||
export const NOT_ALL_SUBMISSIONS_HAVE_SELECTED_GRADE = 'NOT_ALL_SUBMISSIONS_HAVE_SELECTED_GRADE'
|
||||
export const SET_PUBLISH_GRADES_STATUS = 'SET_PUBLISH_GRADES_STATUS'
|
||||
export const SET_RELEASE_GRADES_STATUS = 'SET_RELEASE_GRADES_STATUS'
|
||||
export const SET_UNMUTE_ASSIGNMENT_STATUS = 'SET_UNMUTE_ASSIGNMENT_STATUS'
|
||||
export const STARTED = 'STARTED'
|
||||
export const SUCCESS = 'SUCCESS'
|
||||
export const UPDATE_ASSIGNMENT = 'UPDATE_ASSIGNMENT'
|
||||
|
||||
export function setPublishGradesStatus(status) {
|
||||
return {type: SET_PUBLISH_GRADES_STATUS, payload: {status}}
|
||||
export function setReleaseGradesStatus(status) {
|
||||
return {type: SET_RELEASE_GRADES_STATUS, payload: {status}}
|
||||
}
|
||||
|
||||
export function setUnmuteAssignmentStatus(status) {
|
||||
|
@ -39,28 +39,28 @@ export function updateAssignment(assignment) {
|
|||
return {type: UPDATE_ASSIGNMENT, payload: {assignment}}
|
||||
}
|
||||
|
||||
export function publishGrades() {
|
||||
export function releaseGrades() {
|
||||
return function(dispatch, getState) {
|
||||
const {assignment} = getState().assignment
|
||||
|
||||
dispatch(setPublishGradesStatus(STARTED))
|
||||
dispatch(setReleaseGradesStatus(STARTED))
|
||||
|
||||
AssignmentApi.publishGrades(assignment.courseId, assignment.id)
|
||||
AssignmentApi.releaseGrades(assignment.courseId, assignment.id)
|
||||
.then(() => {
|
||||
dispatch(updateAssignment({gradesPublished: true}))
|
||||
dispatch(setPublishGradesStatus(SUCCESS))
|
||||
dispatch(setReleaseGradesStatus(SUCCESS))
|
||||
})
|
||||
.catch(({response}) => {
|
||||
switch (response.status) {
|
||||
case 400:
|
||||
dispatch(updateAssignment({gradesPublished: true}))
|
||||
dispatch(setPublishGradesStatus(GRADES_ALREADY_PUBLISHED))
|
||||
dispatch(setReleaseGradesStatus(GRADES_ALREADY_RELEASED))
|
||||
break
|
||||
case 422:
|
||||
dispatch(setPublishGradesStatus(NOT_ALL_SUBMISSIONS_HAVE_SELECTED_GRADE))
|
||||
dispatch(setReleaseGradesStatus(NOT_ALL_SUBMISSIONS_HAVE_SELECTED_GRADE))
|
||||
break
|
||||
default:
|
||||
dispatch(setPublishGradesStatus(FAILURE))
|
||||
dispatch(setReleaseGradesStatus(FAILURE))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ export function speedGraderUrl(courseId, assignmentId, options) {
|
|||
return `${path}?${query}`
|
||||
}
|
||||
|
||||
export function publishGrades(courseId, assignmentId) {
|
||||
export function releaseGrades(courseId, assignmentId) {
|
||||
const url = `/api/v1/courses/${courseId}/assignments/${assignmentId}/provisional_grades/publish`
|
||||
|
||||
return axios.post(url)
|
||||
|
|
|
@ -18,15 +18,15 @@
|
|||
|
||||
import {buildReducer, updateIn} from '../ReducerHelpers'
|
||||
import {
|
||||
SET_PUBLISH_GRADES_STATUS,
|
||||
SET_RELEASE_GRADES_STATUS,
|
||||
SET_UNMUTE_ASSIGNMENT_STATUS,
|
||||
UPDATE_ASSIGNMENT
|
||||
} from './AssignmentActions'
|
||||
|
||||
const handlers = {}
|
||||
|
||||
handlers[SET_PUBLISH_GRADES_STATUS] = (state, {payload}) =>
|
||||
updateIn(state, 'assignment', {publishGradesStatus: payload.status})
|
||||
handlers[SET_RELEASE_GRADES_STATUS] = (state, {payload}) =>
|
||||
updateIn(state, 'assignment', {releaseGradesStatus: payload.status})
|
||||
|
||||
handlers[SET_UNMUTE_ASSIGNMENT_STATUS] = (state, {payload}) =>
|
||||
updateIn(state, 'assignment', {unmuteAssignmentStatus: payload.status})
|
||||
|
@ -40,7 +40,7 @@ export default function buildAssignmentReducer(env) {
|
|||
return buildReducer(handlers, {
|
||||
assignment: {
|
||||
assignment: env.assignment,
|
||||
publishGradesStatus: null,
|
||||
releaseGradesStatus: null,
|
||||
unmuteAssignmentStatus: null
|
||||
}
|
||||
})
|
||||
|
|
|
@ -32,22 +32,22 @@ function enumeratedStatuses(actions) {
|
|||
|
||||
const assignmentStatuses = [
|
||||
AssignmentActions.FAILURE,
|
||||
AssignmentActions.GRADES_ALREADY_PUBLISHED,
|
||||
AssignmentActions.GRADES_ALREADY_RELEASED,
|
||||
AssignmentActions.NOT_ALL_SUBMISSIONS_HAVE_SELECTED_GRADE,
|
||||
AssignmentActions.STARTED,
|
||||
AssignmentActions.SUCCESS
|
||||
]
|
||||
|
||||
function announcePublishGradesStatus(status) {
|
||||
function announceReleaseGradesStatus(status) {
|
||||
let message, type
|
||||
|
||||
switch (status) {
|
||||
case AssignmentActions.SUCCESS:
|
||||
message = I18n.t('Grades were successfully published to the gradebook.')
|
||||
message = I18n.t('Grades were successfully released to the gradebook.')
|
||||
type = 'success'
|
||||
break
|
||||
case AssignmentActions.GRADES_ALREADY_PUBLISHED:
|
||||
message = I18n.t('Assignment grades have already been published.')
|
||||
case AssignmentActions.GRADES_ALREADY_RELEASED:
|
||||
message = I18n.t('Assignment grades have already been released.')
|
||||
type = 'error'
|
||||
break
|
||||
case AssignmentActions.NOT_ALL_SUBMISSIONS_HAVE_SELECTED_GRADE:
|
||||
|
@ -55,7 +55,7 @@ function announcePublishGradesStatus(status) {
|
|||
type = 'error'
|
||||
break
|
||||
case AssignmentActions.FAILURE:
|
||||
message = I18n.t('There was a problem publishing grades.')
|
||||
message = I18n.t('There was a problem releasing grades.')
|
||||
type = 'error'
|
||||
break
|
||||
default:
|
||||
|
@ -83,7 +83,7 @@ class FlashMessageHolder extends Component {
|
|||
static propTypes = {
|
||||
bulkSelectProvisionalGradeStatuses: shape({}).isRequired,
|
||||
loadStudentsStatus: oneOf(enumeratedStatuses(StudentActions)),
|
||||
publishGradesStatus: oneOf(assignmentStatuses),
|
||||
releaseGradesStatus: oneOf(assignmentStatuses),
|
||||
selectProvisionalGradeStatuses: shape({}).isRequired,
|
||||
unmuteAssignmentStatus: oneOf(enumeratedStatuses(AssignmentActions)),
|
||||
updateGradeStatuses: arrayOf(
|
||||
|
@ -99,7 +99,7 @@ class FlashMessageHolder extends Component {
|
|||
|
||||
static defaultProps = {
|
||||
loadStudentsStatus: null,
|
||||
publishGradesStatus: null,
|
||||
releaseGradesStatus: null,
|
||||
unmuteAssignmentStatus: null
|
||||
}
|
||||
|
||||
|
@ -181,8 +181,8 @@ class FlashMessageHolder extends Component {
|
|||
})
|
||||
}
|
||||
|
||||
if (changes.publishGradesStatus) {
|
||||
announcePublishGradesStatus(nextProps.publishGradesStatus)
|
||||
if (changes.releaseGradesStatus) {
|
||||
announceReleaseGradesStatus(nextProps.releaseGradesStatus)
|
||||
}
|
||||
|
||||
if (changes.unmuteAssignmentStatus) {
|
||||
|
@ -199,7 +199,7 @@ function mapStateToProps(state) {
|
|||
return {
|
||||
bulkSelectProvisionalGradeStatuses: state.grades.bulkSelectProvisionalGradeStatuses,
|
||||
loadStudentsStatus: state.students.loadStudentsStatus,
|
||||
publishGradesStatus: state.assignment.publishGradesStatus,
|
||||
releaseGradesStatus: state.assignment.releaseGradesStatus,
|
||||
selectProvisionalGradeStatuses: state.grades.selectProvisionalGradeStatuses,
|
||||
unmuteAssignmentStatus: state.assignment.unmuteAssignmentStatus,
|
||||
updateGradeStatuses: state.grades.updateGradeStatuses
|
||||
|
|
|
@ -26,9 +26,9 @@ import Text from '@instructure/ui-elements/lib/components/Text'
|
|||
import I18n from 'i18n!assignment_grade_summary'
|
||||
|
||||
import * as AssignmentActions from '../assignment/AssignmentActions'
|
||||
import DisplayToStudentsButton from './DisplayToStudentsButton'
|
||||
import GradersTable from './GradersTable'
|
||||
import PostButton from './PostButton'
|
||||
import PostToStudentsButton from './PostToStudentsButton'
|
||||
import ReleaseButton from './ReleaseButton'
|
||||
|
||||
/* eslint-disable no-alert */
|
||||
|
||||
|
@ -47,37 +47,35 @@ class Header extends Component {
|
|||
graderId: string.isRequired
|
||||
})
|
||||
).isRequired,
|
||||
publishGrades: func.isRequired,
|
||||
publishGradesStatus: oneOf(enumeratedStatuses(AssignmentActions)),
|
||||
releaseGrades: func.isRequired,
|
||||
releaseGradesStatus: oneOf(enumeratedStatuses(AssignmentActions)),
|
||||
unmuteAssignment: func.isRequired,
|
||||
unmuteAssignmentStatus: oneOf(enumeratedStatuses(AssignmentActions))
|
||||
}
|
||||
|
||||
static defaultProps = {
|
||||
publishGradesStatus: null,
|
||||
releaseGradesStatus: null,
|
||||
unmuteAssignmentStatus: null
|
||||
}
|
||||
|
||||
constructor(props) {
|
||||
super(props)
|
||||
|
||||
this.handlePublishClick = this.handlePublishClick.bind(this)
|
||||
this.handleReleaseClick = this.handleReleaseClick.bind(this)
|
||||
this.handleUnmuteClick = this.handleUnmuteClick.bind(this)
|
||||
}
|
||||
|
||||
handlePublishClick() {
|
||||
handleReleaseClick() {
|
||||
const message = I18n.t(
|
||||
'Are you sure you want to do this? It cannot be undone and will override existing grades in the gradebook.'
|
||||
)
|
||||
if (window.confirm(message)) {
|
||||
this.props.publishGrades()
|
||||
this.props.releaseGrades()
|
||||
}
|
||||
}
|
||||
|
||||
handleUnmuteClick() {
|
||||
const message = I18n.t(
|
||||
'Are you sure you want to display grades for this assignment to students?'
|
||||
)
|
||||
const message = I18n.t('Are you sure you want to post grades for this assignment to students?')
|
||||
if (window.confirm(message)) {
|
||||
this.props.unmuteAssignment()
|
||||
}
|
||||
|
@ -89,7 +87,7 @@ class Header extends Component {
|
|||
{this.props.assignment.gradesPublished && (
|
||||
<Alert margin="0 0 medium 0" variant="info">
|
||||
<Text weight="bold">{I18n.t('Attention!')}</Text>{' '}
|
||||
{I18n.t('Grades cannot be modified from this page as they have already been posted.')}
|
||||
{I18n.t('Grades cannot be modified from this page as they have already been released.')}
|
||||
</Alert>
|
||||
)}
|
||||
|
||||
|
@ -109,16 +107,16 @@ class Header extends Component {
|
|||
<FlexItem align="end" as="div" flex="2" grow>
|
||||
<Flex as="div" justifyItems="end">
|
||||
<FlexItem>
|
||||
<PostButton
|
||||
gradesPublished={this.props.assignment.gradesPublished}
|
||||
<ReleaseButton
|
||||
gradesReleased={this.props.assignment.gradesPublished}
|
||||
margin="0 x-small 0 0"
|
||||
onClick={this.handlePublishClick}
|
||||
publishGradesStatus={this.props.publishGradesStatus}
|
||||
onClick={this.handleReleaseClick}
|
||||
releaseGradesStatus={this.props.releaseGradesStatus}
|
||||
/>
|
||||
</FlexItem>
|
||||
|
||||
<FlexItem>
|
||||
<DisplayToStudentsButton
|
||||
<PostToStudentsButton
|
||||
assignment={this.props.assignment}
|
||||
onClick={this.handleUnmuteClick}
|
||||
unmuteAssignmentStatus={this.props.unmuteAssignmentStatus}
|
||||
|
@ -133,20 +131,20 @@ class Header extends Component {
|
|||
}
|
||||
|
||||
function mapStateToProps(state) {
|
||||
const {assignment, publishGradesStatus, unmuteAssignmentStatus} = state.assignment
|
||||
const {assignment, releaseGradesStatus, unmuteAssignmentStatus} = state.assignment
|
||||
|
||||
return {
|
||||
assignment,
|
||||
graders: state.context.graders,
|
||||
publishGradesStatus,
|
||||
releaseGradesStatus,
|
||||
unmuteAssignmentStatus
|
||||
}
|
||||
}
|
||||
|
||||
function mapDispatchToProps(dispatch) {
|
||||
return {
|
||||
publishGrades() {
|
||||
dispatch(AssignmentActions.publishGrades())
|
||||
releaseGrades() {
|
||||
dispatch(AssignmentActions.releaseGrades())
|
||||
},
|
||||
|
||||
unmuteAssignment() {
|
||||
|
@ -159,3 +157,4 @@ export default connect(
|
|||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(Header)
|
||||
/* eslint-enable no-alert */
|
||||
|
|
|
@ -27,11 +27,11 @@ import I18n from 'i18n!assignment_grade_summary'
|
|||
import {FAILURE, STARTED, SUCCESS} from '../assignment/AssignmentActions'
|
||||
|
||||
function readyButton(props) {
|
||||
return <Button {...props}>{I18n.t('Display to Students')}</Button>
|
||||
return <Button {...props}>{I18n.t('Post to Students')}</Button>
|
||||
}
|
||||
|
||||
function startedButton(props) {
|
||||
const title = I18n.t('Displaying to Students')
|
||||
const title = I18n.t('Posting to Students')
|
||||
|
||||
return (
|
||||
<Button {...props} variant="light">
|
||||
|
@ -43,12 +43,12 @@ function startedButton(props) {
|
|||
function successButton(props) {
|
||||
return (
|
||||
<Button {...props} icon={IconCheckMark} variant="light">
|
||||
{I18n.t('Grades Visible to Students')}
|
||||
{I18n.t('Grades Posted to Students')}
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
|
||||
export default function DisplayToStudentsButton(props) {
|
||||
export default function PostToStudentsButton(props) {
|
||||
const {assignment, onClick, unmuteAssignmentStatus, ...otherProps} = props
|
||||
const unmutable = assignment.gradesPublished && assignment.muted
|
||||
const canClick = ![STARTED, SUCCESS].includes(unmuteAssignmentStatus)
|
||||
|
@ -71,7 +71,7 @@ export default function DisplayToStudentsButton(props) {
|
|||
return readyButton(buttonProps)
|
||||
}
|
||||
|
||||
DisplayToStudentsButton.propTypes = {
|
||||
PostToStudentsButton.propTypes = {
|
||||
assignment: shape({
|
||||
gradesPublished: bool.isRequired,
|
||||
muted: bool.isRequired
|
||||
|
@ -80,6 +80,6 @@ DisplayToStudentsButton.propTypes = {
|
|||
unmuteAssignmentStatus: oneOf([FAILURE, STARTED, SUCCESS])
|
||||
}
|
||||
|
||||
DisplayToStudentsButton.defaultProps = {
|
||||
PostToStudentsButton.defaultProps = {
|
||||
unmuteAssignmentStatus: null
|
||||
}
|
|
@ -26,7 +26,7 @@ import I18n from 'i18n!assignment_grade_summary'
|
|||
|
||||
import {
|
||||
FAILURE,
|
||||
GRADES_ALREADY_PUBLISHED,
|
||||
GRADES_ALREADY_RELEASED,
|
||||
NOT_ALL_SUBMISSIONS_HAVE_SELECTED_GRADE,
|
||||
STARTED,
|
||||
SUCCESS
|
||||
|
@ -35,13 +35,13 @@ import {
|
|||
function readyButton(props) {
|
||||
return (
|
||||
<Button {...props} variant="primary">
|
||||
{I18n.t('Post')}
|
||||
{I18n.t('Release Grades')}
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
|
||||
function startedButton(props) {
|
||||
const title = I18n.t('Grades Posting')
|
||||
const title = I18n.t('Releasing Grades')
|
||||
|
||||
return (
|
||||
<Button {...props} variant="light">
|
||||
|
@ -53,14 +53,14 @@ function startedButton(props) {
|
|||
function successButton(props) {
|
||||
return (
|
||||
<Button {...props} icon={IconCheckMark} variant="light">
|
||||
{I18n.t('Grades Posted')}
|
||||
{I18n.t('Grades Released')}
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
|
||||
export default function PostButton(props) {
|
||||
const {gradesPublished, onClick, publishGradesStatus, ...otherProps} = props
|
||||
const canClick = !(gradesPublished || [STARTED, SUCCESS].includes(publishGradesStatus))
|
||||
export default function ReleaseButton(props) {
|
||||
const {gradesReleased, onClick, releaseGradesStatus, ...otherProps} = props
|
||||
const canClick = !(gradesReleased || [STARTED, SUCCESS].includes(releaseGradesStatus))
|
||||
|
||||
const buttonProps = {
|
||||
...otherProps,
|
||||
|
@ -68,29 +68,29 @@ export default function PostButton(props) {
|
|||
onClick: canClick ? onClick : null
|
||||
}
|
||||
|
||||
if (gradesPublished) {
|
||||
if (gradesReleased) {
|
||||
return successButton(buttonProps)
|
||||
}
|
||||
|
||||
if (publishGradesStatus === STARTED) {
|
||||
if (releaseGradesStatus === STARTED) {
|
||||
return startedButton(buttonProps)
|
||||
}
|
||||
|
||||
return readyButton(buttonProps)
|
||||
}
|
||||
|
||||
PostButton.propTypes = {
|
||||
gradesPublished: bool.isRequired,
|
||||
ReleaseButton.propTypes = {
|
||||
gradesReleased: bool.isRequired,
|
||||
onClick: func.isRequired,
|
||||
publishGradesStatus: oneOf([
|
||||
releaseGradesStatus: oneOf([
|
||||
FAILURE,
|
||||
GRADES_ALREADY_PUBLISHED,
|
||||
GRADES_ALREADY_RELEASED,
|
||||
NOT_ALL_SUBMISSIONS_HAVE_SELECTED_GRADE,
|
||||
STARTED,
|
||||
SUCCESS
|
||||
])
|
||||
}
|
||||
|
||||
PostButton.defaultProps = {
|
||||
publishGradesStatus: null
|
||||
ReleaseButton.defaultProps = {
|
||||
releaseGradesStatus: null
|
||||
}
|
|
@ -44,7 +44,7 @@ QUnit.module('GradeSummary AssignmentActions', suiteHooks => {
|
|||
})
|
||||
})
|
||||
|
||||
QUnit.module('.publishGrades()', hooks => {
|
||||
QUnit.module('.releaseGrades()', hooks => {
|
||||
let args
|
||||
let rejectPromise
|
||||
let resolvePromise
|
||||
|
@ -61,33 +61,33 @@ QUnit.module('GradeSummary AssignmentActions', suiteHooks => {
|
|||
}
|
||||
}
|
||||
|
||||
sinon.stub(AssignmentApi, 'publishGrades').callsFake((courseId, assignmentId) => {
|
||||
sinon.stub(AssignmentApi, 'releaseGrades').callsFake((courseId, assignmentId) => {
|
||||
args = {courseId, assignmentId}
|
||||
return fakePromise
|
||||
})
|
||||
|
||||
store.dispatch(AssignmentActions.publishGrades())
|
||||
store.dispatch(AssignmentActions.releaseGrades())
|
||||
})
|
||||
|
||||
hooks.afterEach(() => {
|
||||
args = null
|
||||
AssignmentApi.publishGrades.restore()
|
||||
AssignmentApi.releaseGrades.restore()
|
||||
})
|
||||
|
||||
test('sets the "publish grades" status to "started"', () => {
|
||||
const {publishGradesStatus} = store.getState().assignment
|
||||
equal(publishGradesStatus, AssignmentActions.STARTED)
|
||||
test('sets the "release grades" status to "started"', () => {
|
||||
const {releaseGradesStatus} = store.getState().assignment
|
||||
equal(releaseGradesStatus, AssignmentActions.STARTED)
|
||||
})
|
||||
|
||||
test('publishes grades through the api', () => {
|
||||
strictEqual(AssignmentApi.publishGrades.callCount, 1)
|
||||
test('releases grades through the api', () => {
|
||||
strictEqual(AssignmentApi.releaseGrades.callCount, 1)
|
||||
})
|
||||
|
||||
test('includes the course id when publishing through the api', () => {
|
||||
test('includes the course id when releasing through the api', () => {
|
||||
strictEqual(args.courseId, '1201')
|
||||
})
|
||||
|
||||
test('includes the assignment id when publishing through the api', () => {
|
||||
test('includes the assignment id when releasing through the api', () => {
|
||||
strictEqual(args.assignmentId, '2301')
|
||||
})
|
||||
|
||||
|
@ -97,28 +97,28 @@ QUnit.module('GradeSummary AssignmentActions', suiteHooks => {
|
|||
strictEqual(assignment.gradesPublished, true)
|
||||
})
|
||||
|
||||
test('sets the "publish grades" status to "success" when the request succeeds', () => {
|
||||
test('sets the "release grades" status to "success" when the request succeeds', () => {
|
||||
resolvePromise()
|
||||
const {publishGradesStatus} = store.getState().assignment
|
||||
equal(publishGradesStatus, AssignmentActions.SUCCESS)
|
||||
const {releaseGradesStatus} = store.getState().assignment
|
||||
equal(releaseGradesStatus, AssignmentActions.SUCCESS)
|
||||
})
|
||||
|
||||
test('sets the "publish grades" status to "already published" when grades were already published', () => {
|
||||
test('sets the "release grades" status to "already released" when grades were already released', () => {
|
||||
rejectPromise({response: {status: 400}})
|
||||
const {publishGradesStatus} = store.getState().assignment
|
||||
equal(publishGradesStatus, AssignmentActions.GRADES_ALREADY_PUBLISHED)
|
||||
const {releaseGradesStatus} = store.getState().assignment
|
||||
equal(releaseGradesStatus, AssignmentActions.GRADES_ALREADY_RELEASED)
|
||||
})
|
||||
|
||||
test('sets the "publish grades" status to "not all selected" when a submission has no selected grade', () => {
|
||||
test('sets the "release grades" status to "not all selected" when a submission has no selected grade', () => {
|
||||
rejectPromise({response: {status: 422}})
|
||||
const {publishGradesStatus} = store.getState().assignment
|
||||
equal(publishGradesStatus, AssignmentActions.NOT_ALL_SUBMISSIONS_HAVE_SELECTED_GRADE)
|
||||
const {releaseGradesStatus} = store.getState().assignment
|
||||
equal(releaseGradesStatus, AssignmentActions.NOT_ALL_SUBMISSIONS_HAVE_SELECTED_GRADE)
|
||||
})
|
||||
|
||||
test('sets the "publish grades" status to "failure" when any other failure occurs', () => {
|
||||
test('sets the "release grades" status to "failure" when any other failure occurs', () => {
|
||||
rejectPromise({response: {status: 500}})
|
||||
const {publishGradesStatus} = store.getState().assignment
|
||||
equal(publishGradesStatus, AssignmentActions.FAILURE)
|
||||
const {releaseGradesStatus} = store.getState().assignment
|
||||
equal(releaseGradesStatus, AssignmentActions.FAILURE)
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -157,15 +157,15 @@ QUnit.module('GradeSummary AssignmentActions', suiteHooks => {
|
|||
equal(unmuteAssignmentStatus, AssignmentActions.STARTED)
|
||||
})
|
||||
|
||||
test('publishes grades through the api', () => {
|
||||
test('releases grades through the api', () => {
|
||||
strictEqual(AssignmentApi.unmuteAssignment.callCount, 1)
|
||||
})
|
||||
|
||||
test('includes the course id when publishing through the api', () => {
|
||||
test('includes the course id when releasing through the api', () => {
|
||||
strictEqual(args.courseId, '1201')
|
||||
})
|
||||
|
||||
test('includes the assignment id when publishing through the api', () => {
|
||||
test('includes the assignment id when releasing through the api', () => {
|
||||
strictEqual(args.assignmentId, '2301')
|
||||
})
|
||||
|
||||
|
|
|
@ -44,19 +44,19 @@ QUnit.module('GradeSummary AssignmentApi', suiteHooks => {
|
|||
})
|
||||
})
|
||||
|
||||
QUnit.module('.publishGrades()', () => {
|
||||
QUnit.module('.releaseGrades()', () => {
|
||||
const url = `/api/v1/courses/1201/assignments/2301/provisional_grades/publish`
|
||||
|
||||
test('sends a request to publish provisional grades', async () => {
|
||||
test('sends a request to release provisional grades', async () => {
|
||||
server.for(url).respond({status: 200, body: {}})
|
||||
await AssignmentApi.publishGrades('1201', '2301')
|
||||
await AssignmentApi.releaseGrades('1201', '2301')
|
||||
const request = server.receivedRequests[0]
|
||||
equal(pathFromRequest(request), url)
|
||||
})
|
||||
|
||||
test('sends a POST request', async () => {
|
||||
server.for(url).respond({status: 200, body: {}})
|
||||
await AssignmentApi.publishGrades('1201', '2301')
|
||||
await AssignmentApi.releaseGrades('1201', '2301')
|
||||
const request = server.receivedRequests[0]
|
||||
equal(request.method, 'POST')
|
||||
})
|
||||
|
@ -64,7 +64,7 @@ QUnit.module('GradeSummary AssignmentApi', suiteHooks => {
|
|||
test('does not catch failures', async () => {
|
||||
server.for(url).respond({status: 500, body: {error: 'server error'}})
|
||||
try {
|
||||
await AssignmentApi.publishGrades('1201', '2301')
|
||||
await AssignmentApi.releaseGrades('1201', '2301')
|
||||
} catch (e) {
|
||||
ok(e.message.includes('500'))
|
||||
}
|
||||
|
|
|
@ -55,38 +55,38 @@ QUnit.module('GradeSummary assignmentReducer()', suiteHooks => {
|
|||
})
|
||||
})
|
||||
|
||||
QUnit.module('when handling "SET_PUBLISH_GRADES_STATUS"', () => {
|
||||
function setPublishGradesStatus(status) {
|
||||
store.dispatch(AssignmentActions.setPublishGradesStatus(status))
|
||||
QUnit.module('when handling "SET_RELEASE_GRADES_STATUS"', () => {
|
||||
function setReleaseGradesStatus(status) {
|
||||
store.dispatch(AssignmentActions.setReleaseGradesStatus(status))
|
||||
}
|
||||
|
||||
function getPublishGradesStatus() {
|
||||
return store.getState().assignment.publishGradesStatus
|
||||
function getReleaseGradesStatus() {
|
||||
return store.getState().assignment.releaseGradesStatus
|
||||
}
|
||||
|
||||
test('optionally sets the "publish grades" status to "failure"', () => {
|
||||
setPublishGradesStatus(AssignmentActions.FAILURE)
|
||||
equal(getPublishGradesStatus(), 'FAILURE')
|
||||
test('optionally sets the "release grades" status to "failure"', () => {
|
||||
setReleaseGradesStatus(AssignmentActions.FAILURE)
|
||||
equal(getReleaseGradesStatus(), 'FAILURE')
|
||||
})
|
||||
|
||||
test('optionally sets the "publish grades" status to "started"', () => {
|
||||
setPublishGradesStatus(AssignmentActions.STARTED)
|
||||
equal(getPublishGradesStatus(), 'STARTED')
|
||||
test('optionally sets the "release grades" status to "started"', () => {
|
||||
setReleaseGradesStatus(AssignmentActions.STARTED)
|
||||
equal(getReleaseGradesStatus(), 'STARTED')
|
||||
})
|
||||
|
||||
test('optionally sets the "publish grades" status to "success"', () => {
|
||||
setPublishGradesStatus(AssignmentActions.SUCCESS)
|
||||
equal(getPublishGradesStatus(), 'SUCCESS')
|
||||
test('optionally sets the "release grades" status to "success"', () => {
|
||||
setReleaseGradesStatus(AssignmentActions.SUCCESS)
|
||||
equal(getReleaseGradesStatus(), 'SUCCESS')
|
||||
})
|
||||
|
||||
test('optionally sets the "publish grades" status to "already published"', () => {
|
||||
setPublishGradesStatus(AssignmentActions.GRADES_ALREADY_PUBLISHED)
|
||||
equal(getPublishGradesStatus(), 'GRADES_ALREADY_PUBLISHED')
|
||||
test('optionally sets the "release grades" status to "already released"', () => {
|
||||
setReleaseGradesStatus(AssignmentActions.GRADES_ALREADY_RELEASED)
|
||||
equal(getReleaseGradesStatus(), 'GRADES_ALREADY_RELEASED')
|
||||
})
|
||||
|
||||
test('optionally sets the "publish grades" status to "not all selected"', () => {
|
||||
setPublishGradesStatus(AssignmentActions.NOT_ALL_SUBMISSIONS_HAVE_SELECTED_GRADE)
|
||||
equal(getPublishGradesStatus(), 'NOT_ALL_SUBMISSIONS_HAVE_SELECTED_GRADE')
|
||||
test('optionally sets the "release grades" status to "not all selected"', () => {
|
||||
setReleaseGradesStatus(AssignmentActions.NOT_ALL_SUBMISSIONS_HAVE_SELECTED_GRADE)
|
||||
equal(getReleaseGradesStatus(), 'NOT_ALL_SUBMISSIONS_HAVE_SELECTED_GRADE')
|
||||
})
|
||||
})
|
||||
|
||||
|
|
|
@ -146,9 +146,9 @@ QUnit.module('GradeSummary FlashMessageHolder', suiteHooks => {
|
|||
})
|
||||
})
|
||||
|
||||
test('does not display a flash alert when publishing grades starts', () => {
|
||||
test('does not display a flash alert when releasing grades starts', () => {
|
||||
mountComponent()
|
||||
store.dispatch(AssignmentActions.setPublishGradesStatus(AssignmentActions.STARTED))
|
||||
store.dispatch(AssignmentActions.setReleaseGradesStatus(AssignmentActions.STARTED))
|
||||
strictEqual(FlashAlert.showFlashAlert.callCount, 0)
|
||||
})
|
||||
|
||||
|
@ -198,9 +198,9 @@ QUnit.module('GradeSummary FlashMessageHolder', suiteHooks => {
|
|||
})
|
||||
})
|
||||
|
||||
test('does not display a flash alert when publishing grades starts', () => {
|
||||
test('does not display a flash alert when releasing grades starts', () => {
|
||||
mountComponent()
|
||||
store.dispatch(AssignmentActions.setPublishGradesStatus(AssignmentActions.STARTED))
|
||||
store.dispatch(AssignmentActions.setReleaseGradesStatus(AssignmentActions.STARTED))
|
||||
strictEqual(FlashAlert.showFlashAlert.callCount, 0)
|
||||
})
|
||||
|
||||
|
@ -343,10 +343,10 @@ QUnit.module('GradeSummary FlashMessageHolder', suiteHooks => {
|
|||
})
|
||||
})
|
||||
|
||||
QUnit.module('when publishing grades succeeds', hooks => {
|
||||
QUnit.module('when releasing grades succeeds', hooks => {
|
||||
hooks.beforeEach(() => {
|
||||
mountComponent()
|
||||
store.dispatch(AssignmentActions.setPublishGradesStatus(AssignmentActions.SUCCESS))
|
||||
store.dispatch(AssignmentActions.setReleaseGradesStatus(AssignmentActions.SUCCESS))
|
||||
})
|
||||
|
||||
test('displays a flash alert', () => {
|
||||
|
@ -358,17 +358,17 @@ QUnit.module('GradeSummary FlashMessageHolder', suiteHooks => {
|
|||
equal(type, 'success')
|
||||
})
|
||||
|
||||
test('includes a message about grades being published', () => {
|
||||
test('includes a message about grades being released', () => {
|
||||
const {message} = FlashAlert.showFlashAlert.lastCall.args[0]
|
||||
equal(message, 'Grades were successfully published to the gradebook.')
|
||||
equal(message, 'Grades were successfully released to the gradebook.')
|
||||
})
|
||||
})
|
||||
|
||||
QUnit.module('when publishing grades fails for having already been published', hooks => {
|
||||
QUnit.module('when releasing grades fails for having already been released', hooks => {
|
||||
hooks.beforeEach(() => {
|
||||
mountComponent()
|
||||
store.dispatch(
|
||||
AssignmentActions.setPublishGradesStatus(AssignmentActions.GRADES_ALREADY_PUBLISHED)
|
||||
AssignmentActions.setReleaseGradesStatus(AssignmentActions.GRADES_ALREADY_RELEASED)
|
||||
)
|
||||
})
|
||||
|
||||
|
@ -381,17 +381,17 @@ QUnit.module('GradeSummary FlashMessageHolder', suiteHooks => {
|
|||
equal(type, 'error')
|
||||
})
|
||||
|
||||
test('includes a message about grades already being published', () => {
|
||||
test('includes a message about grades already being released', () => {
|
||||
const {message} = FlashAlert.showFlashAlert.lastCall.args[0]
|
||||
equal(message, 'Assignment grades have already been published.')
|
||||
equal(message, 'Assignment grades have already been released.')
|
||||
})
|
||||
})
|
||||
|
||||
QUnit.module('when publishing grades fails for not having all grade selections', hooks => {
|
||||
QUnit.module('when releasing grades fails for not having all grade selections', hooks => {
|
||||
hooks.beforeEach(() => {
|
||||
mountComponent()
|
||||
store.dispatch(
|
||||
AssignmentActions.setPublishGradesStatus(
|
||||
AssignmentActions.setReleaseGradesStatus(
|
||||
AssignmentActions.NOT_ALL_SUBMISSIONS_HAVE_SELECTED_GRADE
|
||||
)
|
||||
)
|
||||
|
@ -406,16 +406,16 @@ QUnit.module('GradeSummary FlashMessageHolder', suiteHooks => {
|
|||
equal(type, 'error')
|
||||
})
|
||||
|
||||
test('includes a message about grades already being published', () => {
|
||||
test('includes a message about grades already being released', () => {
|
||||
const {message} = FlashAlert.showFlashAlert.lastCall.args[0]
|
||||
equal(message, 'All submissions must have a selected grade.')
|
||||
})
|
||||
})
|
||||
|
||||
QUnit.module('when publishing grades fails for some other reason', hooks => {
|
||||
QUnit.module('when releasing grades fails for some other reason', hooks => {
|
||||
hooks.beforeEach(() => {
|
||||
mountComponent()
|
||||
store.dispatch(AssignmentActions.setPublishGradesStatus(AssignmentActions.FAILURE))
|
||||
store.dispatch(AssignmentActions.setReleaseGradesStatus(AssignmentActions.FAILURE))
|
||||
})
|
||||
|
||||
test('displays a flash alert', () => {
|
||||
|
@ -427,9 +427,9 @@ QUnit.module('GradeSummary FlashMessageHolder', suiteHooks => {
|
|||
equal(type, 'error')
|
||||
})
|
||||
|
||||
test('includes a message about grades already being published', () => {
|
||||
test('includes a message about grades already being released', () => {
|
||||
const {message} = FlashAlert.showFlashAlert.lastCall.args[0]
|
||||
equal(message, 'There was a problem publishing grades.')
|
||||
equal(message, 'There was a problem releasing grades.')
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -481,3 +481,4 @@ QUnit.module('GradeSummary FlashMessageHolder', suiteHooks => {
|
|||
})
|
||||
})
|
||||
})
|
||||
/* eslint-enable qunit/no-identical-names */
|
||||
|
|
|
@ -75,15 +75,15 @@ QUnit.module('GradeSummary Header', suiteHooks => {
|
|||
equal(childArray[headingIndex + 1].text(), 'Example Assignment')
|
||||
})
|
||||
|
||||
test('includes a "grades posted" message when grades have been published', () => {
|
||||
test('includes a "grades released" message when grades have been released', () => {
|
||||
storeEnv.assignment.gradesPublished = true
|
||||
mountComponent()
|
||||
ok(wrapper.text().includes('they have already been posted'))
|
||||
ok(wrapper.text().includes('they have already been released'))
|
||||
})
|
||||
|
||||
test('excludes the "grades posted" message when grades have not yet been published', () => {
|
||||
test('excludes the "grades released" message when grades have not yet been released', () => {
|
||||
mountComponent()
|
||||
notOk(wrapper.text().includes('they have already been posted'))
|
||||
notOk(wrapper.text().includes('they have already been released'))
|
||||
})
|
||||
|
||||
QUnit.module('Graders Table', () => {
|
||||
|
@ -99,59 +99,59 @@ QUnit.module('GradeSummary Header', suiteHooks => {
|
|||
})
|
||||
})
|
||||
|
||||
QUnit.module('"Post" button', hooks => {
|
||||
QUnit.module('"Release Grades" button', hooks => {
|
||||
hooks.beforeEach(() => {
|
||||
sinon.stub(window, 'confirm').returns(true)
|
||||
sinon
|
||||
.stub(AssignmentActions, 'publishGrades')
|
||||
.returns(AssignmentActions.setPublishGradesStatus(AssignmentActions.STARTED))
|
||||
.stub(AssignmentActions, 'releaseGrades')
|
||||
.returns(AssignmentActions.setReleaseGradesStatus(AssignmentActions.STARTED))
|
||||
})
|
||||
|
||||
hooks.afterEach(() => {
|
||||
AssignmentActions.publishGrades.restore()
|
||||
AssignmentActions.releaseGrades.restore()
|
||||
window.confirm.restore()
|
||||
})
|
||||
|
||||
test('is always displayed', () => {
|
||||
storeEnv.graders = []
|
||||
mountComponent()
|
||||
strictEqual(wrapper.find('PostButton').length, 1)
|
||||
strictEqual(wrapper.find('ReleaseButton').length, 1)
|
||||
})
|
||||
|
||||
test('receives the assignment gradesPublished property as a prop', () => {
|
||||
mountComponent()
|
||||
strictEqual(wrapper.find('PostButton').prop('gradesPublished'), false)
|
||||
strictEqual(wrapper.find('ReleaseButton').prop('gradesReleased'), false)
|
||||
})
|
||||
|
||||
test('receives the unmuteAssignmentStatus as a prop', () => {
|
||||
mountComponent()
|
||||
store.dispatch(AssignmentActions.setPublishGradesStatus(AssignmentActions.STARTED))
|
||||
store.dispatch(AssignmentActions.setReleaseGradesStatus(AssignmentActions.STARTED))
|
||||
wrapper.update()
|
||||
const button = wrapper.find('PostButton')
|
||||
equal(button.prop('publishGradesStatus'), AssignmentActions.STARTED)
|
||||
const button = wrapper.find('ReleaseButton')
|
||||
equal(button.prop('releaseGradesStatus'), AssignmentActions.STARTED)
|
||||
})
|
||||
|
||||
test('displays a confirmation dialog when clicked', () => {
|
||||
mountComponent()
|
||||
wrapper.find('PostButton').simulate('click')
|
||||
wrapper.find('ReleaseButton').simulate('click')
|
||||
strictEqual(window.confirm.callCount, 1)
|
||||
})
|
||||
|
||||
test('publishes grades when dialog is confirmed', () => {
|
||||
test('releases grades when dialog is confirmed', () => {
|
||||
mountComponent()
|
||||
wrapper.find('PostButton').simulate('click')
|
||||
equal(store.getState().assignment.publishGradesStatus, AssignmentActions.STARTED)
|
||||
wrapper.find('ReleaseButton').simulate('click')
|
||||
equal(store.getState().assignment.releaseGradesStatus, AssignmentActions.STARTED)
|
||||
})
|
||||
|
||||
test('does not publish grades when dialog is dismissed', () => {
|
||||
test('does not release grades when dialog is dismissed', () => {
|
||||
window.confirm.returns(false)
|
||||
mountComponent()
|
||||
wrapper.find('PostButton').simulate('click')
|
||||
strictEqual(store.getState().assignment.publishGradesStatus, null)
|
||||
wrapper.find('ReleaseButton').simulate('click')
|
||||
strictEqual(store.getState().assignment.releaseGradesStatus, null)
|
||||
})
|
||||
})
|
||||
|
||||
QUnit.module('"Display to Students" button', hooks => {
|
||||
QUnit.module('"Post to Students" button', hooks => {
|
||||
hooks.beforeEach(() => {
|
||||
storeEnv.assignment.gradesPublished = true
|
||||
sinon.stub(window, 'confirm').returns(true)
|
||||
|
@ -168,12 +168,12 @@ QUnit.module('GradeSummary Header', suiteHooks => {
|
|||
test('is always displayed', () => {
|
||||
storeEnv.graders = []
|
||||
mountComponent()
|
||||
strictEqual(wrapper.find('DisplayToStudentsButton').length, 1)
|
||||
strictEqual(wrapper.find('PostToStudentsButton').length, 1)
|
||||
})
|
||||
|
||||
test('receives the assignment as a prop', () => {
|
||||
mountComponent()
|
||||
const button = wrapper.find('DisplayToStudentsButton')
|
||||
const button = wrapper.find('PostToStudentsButton')
|
||||
deepEqual(button.prop('assignment'), storeEnv.assignment)
|
||||
})
|
||||
|
||||
|
@ -181,26 +181,26 @@ QUnit.module('GradeSummary Header', suiteHooks => {
|
|||
mountComponent()
|
||||
store.dispatch(AssignmentActions.setUnmuteAssignmentStatus(AssignmentActions.STARTED))
|
||||
wrapper.update()
|
||||
const button = wrapper.find('DisplayToStudentsButton')
|
||||
const button = wrapper.find('PostToStudentsButton')
|
||||
equal(button.prop('unmuteAssignmentStatus'), AssignmentActions.STARTED)
|
||||
})
|
||||
|
||||
test('displays a confirmation dialog when clicked', () => {
|
||||
mountComponent()
|
||||
wrapper.find('DisplayToStudentsButton').simulate('click')
|
||||
wrapper.find('PostToStudentsButton').simulate('click')
|
||||
strictEqual(window.confirm.callCount, 1)
|
||||
})
|
||||
|
||||
test('unmutes the assignment when dialog is confirmed', () => {
|
||||
mountComponent()
|
||||
wrapper.find('DisplayToStudentsButton').simulate('click')
|
||||
wrapper.find('PostToStudentsButton').simulate('click')
|
||||
equal(store.getState().assignment.unmuteAssignmentStatus, AssignmentActions.STARTED)
|
||||
})
|
||||
|
||||
test('does not unmute the assignment when dialog is dismissed', () => {
|
||||
window.confirm.returns(false)
|
||||
mountComponent()
|
||||
wrapper.find('DisplayToStudentsButton').simulate('click')
|
||||
wrapper.find('PostToStudentsButton').simulate('click')
|
||||
strictEqual(store.getState().assignment.unmuteAssignmentStatus, null)
|
||||
})
|
||||
})
|
||||
|
|
|
@ -145,7 +145,7 @@ QUnit.module('GradeSummary Layout', suiteHooks => {
|
|||
strictEqual(statuses, store.getState().grades.selectProvisionalGradeStatuses)
|
||||
})
|
||||
|
||||
QUnit.module('when grades have not been published', () => {
|
||||
QUnit.module('when grades have not been released', () => {
|
||||
test('onGradeSelect prop selects a provisional grade', () => {
|
||||
mountAndInitialize()
|
||||
const onGradeSelect = wrapper.find('GradesGrid').prop('onGradeSelect')
|
||||
|
@ -175,12 +175,12 @@ QUnit.module('GradeSummary Layout', suiteHooks => {
|
|||
})
|
||||
})
|
||||
|
||||
QUnit.module('when grades have been published', contextHooks => {
|
||||
QUnit.module('when grades have been released', contextHooks => {
|
||||
contextHooks.beforeEach(() => {
|
||||
storeEnv.assignment.gradesPublished = true
|
||||
})
|
||||
|
||||
test('onGradeSelect prop is null when grades have been published', () => {
|
||||
test('onGradeSelect prop is null when grades have been released', () => {
|
||||
mountAndInitialize()
|
||||
const onGradeSelect = wrapper.find('GradesGrid').prop('onGradeSelect')
|
||||
strictEqual(onGradeSelect, null)
|
||||
|
|
|
@ -20,9 +20,9 @@ import React from 'react'
|
|||
import {mount} from 'enzyme'
|
||||
|
||||
import {FAILURE, STARTED} from 'jsx/assignments/GradeSummary/assignment/AssignmentActions'
|
||||
import DisplayToStudentsButton from 'jsx/assignments/GradeSummary/components/DisplayToStudentsButton'
|
||||
import PostToStudentsButton from 'jsx/assignments/GradeSummary/components/PostToStudentsButton'
|
||||
|
||||
QUnit.module('GradeSummary DisplayToStudentsButton', suiteHooks => {
|
||||
QUnit.module('GradeSummary PostToStudentsButton', suiteHooks => {
|
||||
let props
|
||||
let wrapper
|
||||
|
||||
|
@ -42,17 +42,17 @@ QUnit.module('GradeSummary DisplayToStudentsButton', suiteHooks => {
|
|||
})
|
||||
|
||||
function mountComponent() {
|
||||
wrapper = mount(<DisplayToStudentsButton {...props} />)
|
||||
wrapper = mount(<PostToStudentsButton {...props} />)
|
||||
}
|
||||
|
||||
QUnit.module('when grades have not been published', contextHooks => {
|
||||
QUnit.module('when grades have not been released', contextHooks => {
|
||||
contextHooks.beforeEach(() => {
|
||||
props.assignment.gradesPublished = false
|
||||
mountComponent()
|
||||
})
|
||||
|
||||
test('is labeled with "Display to Students"', () => {
|
||||
equal(wrapper.find('button').text(), 'Display to Students')
|
||||
test('is labeled with "Post to Students"', () => {
|
||||
equal(wrapper.find('button').text(), 'Post to Students')
|
||||
})
|
||||
|
||||
test('is disabled', () => {
|
||||
|
@ -65,11 +65,11 @@ QUnit.module('GradeSummary DisplayToStudentsButton', suiteHooks => {
|
|||
})
|
||||
})
|
||||
|
||||
QUnit.module('when grades are not yet displayed to students', contextHooks => {
|
||||
QUnit.module('when grades are not yet posted to students', contextHooks => {
|
||||
contextHooks.beforeEach(mountComponent)
|
||||
|
||||
test('is labeled with "Display to Students"', () => {
|
||||
equal(wrapper.find('button').text(), 'Display to Students')
|
||||
test('is labeled with "Post to Students"', () => {
|
||||
equal(wrapper.find('button').text(), 'Post to Students')
|
||||
})
|
||||
|
||||
test('is not read-only', () => {
|
||||
|
@ -82,17 +82,17 @@ QUnit.module('GradeSummary DisplayToStudentsButton', suiteHooks => {
|
|||
})
|
||||
})
|
||||
|
||||
QUnit.module('when grades are being displayed to students', contextHooks => {
|
||||
QUnit.module('when grades are being posted to students', contextHooks => {
|
||||
contextHooks.beforeEach(() => {
|
||||
props.unmuteAssignmentStatus = STARTED
|
||||
mountComponent()
|
||||
})
|
||||
|
||||
test('is labeled with "Displaying to Students"', () => {
|
||||
test('is labeled with "Posting to Students"', () => {
|
||||
// The Spinner in the button duplicates the label. Assert that the label
|
||||
// includes the expected text, but is not exactly equal.
|
||||
const label = wrapper.find('button').text()
|
||||
ok(label.match(/Displaying to Students/))
|
||||
ok(label.match(/Posting to Students/))
|
||||
})
|
||||
|
||||
test('is read-only', () => {
|
||||
|
@ -111,11 +111,11 @@ QUnit.module('GradeSummary DisplayToStudentsButton', suiteHooks => {
|
|||
mountComponent()
|
||||
})
|
||||
|
||||
test('is labeled with "Grades Visible to Students"', () => {
|
||||
test('is labeled with "Grades Posted to Students"', () => {
|
||||
// The Icon in the button duplicates the label. Assert that the label
|
||||
// includes the expected text, but is not exactly equal.
|
||||
const label = wrapper.find('button').text()
|
||||
ok(label.match(/Grades Visible to Students/))
|
||||
ok(label.match(/Grades Posted to Students/))
|
||||
})
|
||||
|
||||
test('is read-only', () => {
|
||||
|
@ -128,14 +128,14 @@ QUnit.module('GradeSummary DisplayToStudentsButton', suiteHooks => {
|
|||
})
|
||||
})
|
||||
|
||||
QUnit.module('when displaying to students failed', contextHooks => {
|
||||
QUnit.module('when posting to students failed', contextHooks => {
|
||||
contextHooks.beforeEach(() => {
|
||||
props.unmuteAssignmentStatus = FAILURE
|
||||
mountComponent()
|
||||
})
|
||||
|
||||
test('is labeled with "Display to Students"', () => {
|
||||
equal(wrapper.find('button').text(), 'Display to Students')
|
||||
test('is labeled with "Post to Students"', () => {
|
||||
equal(wrapper.find('button').text(), 'Post to Students')
|
||||
})
|
||||
|
||||
test('is not read-only', () => {
|
|
@ -24,17 +24,17 @@ import {
|
|||
NOT_ALL_SUBMISSIONS_HAVE_SELECTED_GRADE,
|
||||
STARTED
|
||||
} from 'jsx/assignments/GradeSummary/assignment/AssignmentActions'
|
||||
import PostButton from 'jsx/assignments/GradeSummary/components/PostButton'
|
||||
import ReleaseButton from 'jsx/assignments/GradeSummary/components/ReleaseButton'
|
||||
|
||||
QUnit.module('GradeSummary PostButton', suiteHooks => {
|
||||
QUnit.module('GradeSummary ReleaseButton', suiteHooks => {
|
||||
let props
|
||||
let wrapper
|
||||
|
||||
suiteHooks.beforeEach(() => {
|
||||
props = {
|
||||
gradesPublished: false,
|
||||
gradesReleased: false,
|
||||
onClick: sinon.spy(),
|
||||
publishGradesStatus: null
|
||||
releaseGradesStatus: null
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -43,14 +43,14 @@ QUnit.module('GradeSummary PostButton', suiteHooks => {
|
|||
})
|
||||
|
||||
function mountComponent() {
|
||||
wrapper = mount(<PostButton {...props} />)
|
||||
wrapper = mount(<ReleaseButton {...props} />)
|
||||
}
|
||||
|
||||
QUnit.module('when grades have not been published', contextHooks => {
|
||||
QUnit.module('when grades have not been released', contextHooks => {
|
||||
contextHooks.beforeEach(mountComponent)
|
||||
|
||||
test('is labeled with "Post"', () => {
|
||||
equal(wrapper.find('button').text(), 'Post')
|
||||
test('is labeled with "Release Grades"', () => {
|
||||
equal(wrapper.find('button').text(), 'Release Grades')
|
||||
})
|
||||
|
||||
test('is not read-only', () => {
|
||||
|
@ -63,17 +63,17 @@ QUnit.module('GradeSummary PostButton', suiteHooks => {
|
|||
})
|
||||
})
|
||||
|
||||
QUnit.module('when grades are being published', contextHooks => {
|
||||
QUnit.module('when grades are being released', contextHooks => {
|
||||
contextHooks.beforeEach(() => {
|
||||
props.publishGradesStatus = STARTED
|
||||
props.releaseGradesStatus = STARTED
|
||||
mountComponent()
|
||||
})
|
||||
|
||||
test('is labeled with "Posting Grades"', () => {
|
||||
test('is labeled with "Releasing Grades"', () => {
|
||||
// The Spinner in the button duplicates the label. Assert that the label
|
||||
// includes the expected text, but is not exactly equal.
|
||||
const label = wrapper.find('button').text()
|
||||
ok(label.match(/Posting Grades/))
|
||||
ok(label.match(/Releasing Grades/))
|
||||
})
|
||||
|
||||
test('is read-only', () => {
|
||||
|
@ -86,17 +86,17 @@ QUnit.module('GradeSummary PostButton', suiteHooks => {
|
|||
})
|
||||
})
|
||||
|
||||
QUnit.module('when grades have been published', contextHooks => {
|
||||
QUnit.module('when grades have been released', contextHooks => {
|
||||
contextHooks.beforeEach(() => {
|
||||
props.gradesPublished = true
|
||||
props.gradesReleased = true
|
||||
mountComponent()
|
||||
})
|
||||
|
||||
test('is labeled with "Grades Posted"', () => {
|
||||
test('is labeled with "Grades Released"', () => {
|
||||
// The Icon in the button duplicates the label. Assert that the label
|
||||
// includes the expected text, but is not exactly equal.
|
||||
const label = wrapper.find('button').text()
|
||||
ok(label.match(/Grades Posted/))
|
||||
ok(label.match(/Grades Released/))
|
||||
})
|
||||
|
||||
test('is read-only', () => {
|
||||
|
@ -109,14 +109,14 @@ QUnit.module('GradeSummary PostButton', suiteHooks => {
|
|||
})
|
||||
})
|
||||
|
||||
QUnit.module('when grade publishing failed', contextHooks => {
|
||||
QUnit.module('when grade releasing failed', contextHooks => {
|
||||
contextHooks.beforeEach(() => {
|
||||
props.publishGradesStatus = FAILURE
|
||||
props.releaseGradesStatus = FAILURE
|
||||
mountComponent()
|
||||
})
|
||||
|
||||
test('is labeled with "Post"', () => {
|
||||
equal(wrapper.find('button').text(), 'Post')
|
||||
test('is labeled with "Release Grades"', () => {
|
||||
equal(wrapper.find('button').text(), 'Release Grades')
|
||||
})
|
||||
|
||||
test('is not read-only', () => {
|
||||
|
@ -129,14 +129,14 @@ QUnit.module('GradeSummary PostButton', suiteHooks => {
|
|||
})
|
||||
})
|
||||
|
||||
QUnit.module('when grade publishing failed for missing grade selections', contextHooks => {
|
||||
QUnit.module('when grade releasing failed for missing grade selections', contextHooks => {
|
||||
contextHooks.beforeEach(() => {
|
||||
props.publishGradesStatus = NOT_ALL_SUBMISSIONS_HAVE_SELECTED_GRADE
|
||||
props.releaseGradesStatus = NOT_ALL_SUBMISSIONS_HAVE_SELECTED_GRADE
|
||||
mountComponent()
|
||||
})
|
||||
|
||||
test('is labeled with "Post"', () => {
|
||||
equal(wrapper.find('button').text(), 'Post')
|
||||
test('is labeled with "Release Grades"', () => {
|
||||
equal(wrapper.find('button').text(), 'Release Grades')
|
||||
})
|
||||
|
||||
test('is not read-only', () => {
|
|
@ -111,13 +111,13 @@ describe 'Moderated Marking' do
|
|||
ModeratePage.visit(@moderated_course.id, @moderated_assignment.id)
|
||||
end
|
||||
|
||||
it 'allows viewing provisional grades and posting final grade', priority: '1', test_id: 3503385 do
|
||||
it 'allows viewing provisional grades and releasing final grade', priority: '1', test_id: 3503385 do
|
||||
# # select a provisional grade for each student
|
||||
ModeratePage.select_provisional_grade_for_student_by_position(@student1, 1)
|
||||
ModeratePage.select_provisional_grade_for_student_by_position(@student2, 2)
|
||||
|
||||
# # post the grades
|
||||
ModeratePage.click_post_grades_button
|
||||
# # release the grades
|
||||
ModeratePage.click_release_grades_button
|
||||
driver.switch_to.alert.accept
|
||||
wait_for_ajaximations
|
||||
|
||||
|
@ -129,24 +129,24 @@ describe 'Moderated Marking' do
|
|||
expect(Gradebook.grading_cell_attributes(0, 1).text).to eq('12')
|
||||
end
|
||||
|
||||
it 'display to student allows viewing final grade as student', priority: '1', test_id: 3513992 do
|
||||
it 'post to student allows viewing final grade as student', priority: '1', test_id: 3513992 do
|
||||
# select a provisional grade for each student
|
||||
ModeratePage.select_provisional_grade_for_student_by_position(@student1, 1)
|
||||
ModeratePage.select_provisional_grade_for_student_by_position(@student2, 2)
|
||||
|
||||
# post the grades
|
||||
ModeratePage.click_post_grades_button
|
||||
# release the grades
|
||||
ModeratePage.click_release_grades_button
|
||||
driver.switch_to.alert.accept
|
||||
wait_for_ajaximations
|
||||
# wait for element to exist, means page has loaded
|
||||
ModeratePage.grades_posted_button
|
||||
ModeratePage.grades_released_button
|
||||
|
||||
# unmute using Display to Students button
|
||||
ModeratePage.click_display_to_students_button
|
||||
# unmute using Post to Students button
|
||||
ModeratePage.click_post_to_students_button
|
||||
driver.switch_to.alert.accept
|
||||
wait_for_ajaximations
|
||||
# wait for element to exist, means page has loaded
|
||||
ModeratePage.grades_posted_button
|
||||
ModeratePage.grades_released_button
|
||||
|
||||
# switch session to student
|
||||
user_session(@student1)
|
||||
|
@ -170,19 +170,19 @@ describe 'Moderated Marking' do
|
|||
ModeratePage.select_provisional_grade_for_student_by_position(@student1, 1)
|
||||
ModeratePage.select_provisional_grade_for_student_by_position(@student2, 2)
|
||||
|
||||
# post the grades
|
||||
ModeratePage.click_post_grades_button
|
||||
# release the grades
|
||||
ModeratePage.click_release_grades_button
|
||||
driver.switch_to.alert.accept
|
||||
wait_for_ajaximations
|
||||
# wait for element to exist, means page has loaded
|
||||
ModeratePage.grades_posted_button
|
||||
ModeratePage.grades_released_button
|
||||
|
||||
# unmute using Display to Students button
|
||||
ModeratePage.click_display_to_students_button
|
||||
# unmute using Post to Students button
|
||||
ModeratePage.click_post_to_students_button
|
||||
driver.switch_to.alert.accept
|
||||
wait_for_ajaximations
|
||||
# wait for element to exist, means page has loaded
|
||||
ModeratePage.grades_visible_to_students_button
|
||||
ModeratePage.grades_posted_to_students_button
|
||||
|
||||
# switch session to student
|
||||
user_session(@student1)
|
||||
|
@ -194,8 +194,8 @@ describe 'Moderated Marking' do
|
|||
expect(StudentGradesPage.comments(@moderated_assignment).first).to include_text 'Just a comment by teacher 2'
|
||||
end
|
||||
|
||||
it 'display to students button disabled until grades are posted', priority: '1', test_id: 3513991 do
|
||||
expect(ModeratePage.display_to_students_button).to be_disabled
|
||||
it 'post to students button disabled until grades are released', priority: '1', test_id: 3513991 do
|
||||
expect(ModeratePage.post_to_students_button).to be_disabled
|
||||
end
|
||||
|
||||
it 'allows viewing provisional grades', priority: '1', test_id: 3503385 do
|
||||
|
|
|
@ -32,12 +32,12 @@ class ModeratePage
|
|||
grade_input_dropdown_list(student)[position].click
|
||||
end
|
||||
|
||||
def click_post_grades_button
|
||||
post_grades_button.click
|
||||
def click_release_grades_button
|
||||
release_grades_button.click
|
||||
end
|
||||
|
||||
def click_display_to_students_button
|
||||
display_to_students_button.click
|
||||
def click_post_to_students_button
|
||||
post_to_students_button.click
|
||||
end
|
||||
|
||||
def click_page_number(page_number)
|
||||
|
@ -116,20 +116,20 @@ class ModeratePage
|
|||
fj(".GradesGrid__BodyRow:contains('#{name}')")
|
||||
end
|
||||
|
||||
def post_grades_button
|
||||
fj("button:contains('Post')")
|
||||
def release_grades_button
|
||||
fj("button:contains('Release Grades')")
|
||||
end
|
||||
|
||||
def grades_posted_button
|
||||
fj("button:contains('Grades Posted')")
|
||||
def grades_released_button
|
||||
fj("button:contains('Grades Released')")
|
||||
end
|
||||
|
||||
def display_to_students_button
|
||||
fj("button:contains('Display to Students')")
|
||||
def post_to_students_button
|
||||
fj("button:contains('Post to Students')")
|
||||
end
|
||||
|
||||
def grades_visible_to_students_button
|
||||
fj("button:contains('Grades Visible to Students')")
|
||||
def grades_posted_to_students_button
|
||||
fj("button:contains('Grades Posted to Students')")
|
||||
end
|
||||
|
||||
def page_buttons
|
||||
|
|
|
@ -99,7 +99,7 @@ describe 'Audit Trail' do
|
|||
expect(Speedgrader.audit_entries).to include_text("Grades posted")
|
||||
end
|
||||
|
||||
it 'show entry for grades displayed to students', priority: "1", test_id: 3513995 do
|
||||
it 'show entry for grades posted to students', priority: "1", test_id: 3513995 do
|
||||
complete_moderation!
|
||||
|
||||
user_session(@auditor)
|
||||
|
@ -186,16 +186,16 @@ describe 'Audit Trail' do
|
|||
ModeratePage.select_provisional_grade_for_student_by_position(@student1, 1)
|
||||
ModeratePage.select_provisional_grade_for_student_by_position(@student2, 2)
|
||||
# post the grades
|
||||
ModeratePage.click_post_grades_button
|
||||
ModeratePage.click_release_grades_button
|
||||
driver.switch_to.alert.accept
|
||||
wait_for_ajaximations
|
||||
# wait for element to exist, means page has loaded
|
||||
ModeratePage.grades_posted_button
|
||||
# unmute using Display to Students button
|
||||
ModeratePage.click_display_to_students_button
|
||||
ModeratePage.grades_released_button
|
||||
# unmute using Post to Students button
|
||||
ModeratePage.click_post_to_students_button
|
||||
driver.switch_to.alert.accept
|
||||
wait_for_ajaximations
|
||||
# wait for element to exist, means page has loaded
|
||||
ModeratePage.grades_visible_to_students_button
|
||||
ModeratePage.grades_posted_to_students_button
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue