Handle default points possible value

flag=discussion_create
refs VICE-3990

Test Plan
1. Create a graded assignment
2. in console, set it to nil
3. Open graded discsusion edit
4. Verify that Points possible is 0

Change-Id: I44f36db0fee32125e4bc1830a2a79045be1b0d06
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/334382
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Reviewed-by: Drake Harper <drake.harper@instructure.com>
Product-Review: Drake Harper <drake.harper@instructure.com>
This commit is contained in:
Jason Gillett 2023-12-04 12:00:18 -07:00
parent fdc51ca376
commit f9ee34b8fb
2 changed files with 15 additions and 3 deletions

View File

@ -65,7 +65,10 @@ export const GradedDiscussionOptions = ({
return (
<View as="div">
<View as="div" margin="medium 0">
<PointsPossible pointsPossible={pointsPossible} setPointsPossible={setPointsPossible} />
<PointsPossible
pointsPossible={pointsPossible || 0}
setPointsPossible={setPointsPossible}
/>
</View>
<View as="div" margin="medium 0">
<DisplayGradeAs displayGradeAs={displayGradeAs} setDisplayGradeAs={setDisplayGradeAs} />

View File

@ -39,8 +39,8 @@ const defaultProps = {
setAssignedInfoList: () => {},
}
const renderGradedDiscussionOptions = () => {
return render(<GradedDiscussionOptions {...defaultProps} />)
const renderGradedDiscussionOptions = (props = {}) => {
return render(<GradedDiscussionOptions {...defaultProps} {...props} />)
}
describe('GradedDiscussionOptions', () => {
it('renders', () => {
@ -51,4 +51,13 @@ describe('GradedDiscussionOptions', () => {
expect(getByText('Peer Reviews')).toBeInTheDocument()
expect(getByText('Assignment Settings')).toBeInTheDocument()
})
it('renders with null points possible value', () => {
const {getByText} = renderGradedDiscussionOptions({pointsPossible: null})
expect(getByText('Points Possible')).toBeInTheDocument()
expect(getByText('Display Grade As')).toBeInTheDocument()
expect(getByText('Assignment Group')).toBeInTheDocument()
expect(getByText('Peer Reviews')).toBeInTheDocument()
expect(getByText('Assignment Settings')).toBeInTheDocument()
})
})