Skip to content

Commit

Permalink
Say "term" when the pp end date is constrained by the term
Browse files Browse the repository at this point in the history
closes LS-2891
flag=pace_plans

test plan:
  - in a course with a pace plan
  - in settings, set Participation to "Course" and enter dates
  - go to pace plans and click Show Projections, uncheck
    Required Completion... checkbox if checked
  > expect the caption under End Date to say
    "Required by course end date"
  - create a term if you don't have one
    - see /accounts/:id/terms
  - from course settings, set Term to be a term with an end date
  - go to pace plans and click Show Projections
  > expect the caption under End Date to say
    "Required by term end date"
  - check Require Completion by Specified End Date
  > expect the caption to say
    "Required by specified end date

Change-Id: I132188385976e5d27142b472dfb3b5465aa803c7
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/282876
Reviewed-by: Jackson Howe <[email protected]>
QA-Review: Jackson Howe <[email protected]>
Product-Review: Ed Schiebel <[email protected]>
Tested-by: Service Cloud Jenkins <[email protected]>
  • Loading branch information
eschiebel committed Jan 18, 2022
1 parent 5230ae2 commit 5929e07
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,25 @@ describe('ProjectedDates', () => {
expect(getByTestId('paceplan-date-text').textContent).toStrictEqual('December 31, 2021')
})

it('shows term end date text', () => {
window.ENV.VALID_DATE_RANGE = {
end_at: {date: COURSE.end_at, date_context: 'term'},
start_at: {date: COURSE.start_at, date_context: 'term'}
}
const plan = {
...defaultProps.pacePlan,
hard_end_dates: false,
start_sate: '2022-01-03',
end_date: undefined
}
const {getAllByText, getByTestId} = renderConnected(
<ProjectedDates {...defaultProps} pacePlan={plan} />
)
expect(getAllByText('Required by term end date').length).toBeTruthy()
// expect the term end date
expect(getByTestId('paceplan-date-text').textContent).toStrictEqual('December 31, 2021')
})

it('shows specified end date input', () => {
const {getAllByText, getByDisplayValue} = renderConnected(
<ProjectedDates {...defaultProps} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,11 @@ export const ProjectedDates: React.FC<ComponentProps> = ({
endDateInteraction = planPublishing ? 'disabled' : 'enabled'
} else if (ENV.VALID_DATE_RANGE.end_at.date) {
endDateValue = ENV.VALID_DATE_RANGE.end_at.date
endHelpText = I18n.t('Required by course end date')
if (ENV.VALID_DATE_RANGE.end_at.date_context === 'course') {
endHelpText = I18n.t('Required by course end date')
} else {
endHelpText = I18n.t('Required by term end date')
}
endDateInteraction = 'readonly'
} else {
endDateValue = projectedEndDate
Expand Down

0 comments on commit 5929e07

Please sign in to comment.