Say "term" when the pp end date is constrained by the term

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 <jackson.howe@instructure.com>
QA-Review: Jackson Howe <jackson.howe@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
This commit is contained in:
Ed Schiebel 2022-01-14 13:30:08 -05:00
parent 5230ae2946
commit 5929e07e36
2 changed files with 24 additions and 1 deletions

View File

@ -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} />

View File

@ -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