diff --git a/src/components/EditCoursePage/__snapshots__/CollapsibleCourseRun.test.jsx.snap b/src/components/EditCoursePage/__snapshots__/CollapsibleCourseRun.test.jsx.snap index 0b641dea9..70556203d 100644 --- a/src/components/EditCoursePage/__snapshots__/CollapsibleCourseRun.test.jsx.snap +++ b/src/components/EditCoursePage/__snapshots__/CollapsibleCourseRun.test.jsx.snap @@ -67,15 +67,15 @@ exports[`Collapsible Course Run renders correctly variant_id field for external className="text-primary ml-2" fade={false} fixedWidth={false} - flip={null} + flip={false} icon={ Object { "icon": Array [ - 512, + 448, 512, Array [], "f0c5", - "M502.6 70.63l-61.25-61.25C435.4 3.371 427.2 0 418.7 0H255.1c-35.35 0-64 28.66-64 64l.0195 256C192 355.4 220.7 384 256 384h192c35.2 0 64-28.8 64-64V93.25C512 84.77 508.6 76.63 502.6 70.63zM464 320c0 8.836-7.164 16-16 16H255.1c-8.838 0-16-7.164-16-16L239.1 64.13c0-8.836 7.164-16 16-16h128L384 96c0 17.67 14.33 32 32 32h47.1V320zM272 448c0 8.836-7.164 16-16 16H63.1c-8.838 0-16-7.164-16-16L47.98 192.1c0-8.836 7.164-16 16-16H160V128H63.99c-35.35 0-64 28.65-64 64l.0098 256C.002 483.3 28.66 512 64 512h192c35.2 0 64-28.8 64-64v-32h-47.1L272 448z", + "M384 336H192c-8.8 0-16-7.2-16-16V64c0-8.8 7.2-16 16-16l140.1 0L400 115.9V320c0 8.8-7.2 16-16 16zM192 384H384c35.3 0 64-28.7 64-64V115.9c0-12.7-5.1-24.9-14.1-33.9L366.1 14.1c-9-9-21.2-14.1-33.9-14.1H192c-35.3 0-64 28.7-64 64V320c0 35.3 28.7 64 64 64zM64 128c-35.3 0-64 28.7-64 64V448c0 35.3 28.7 64 64 64H256c35.3 0 64-28.7 64-64V416H272v32c0 8.8-7.2 16-16 16H64c-8.8 0-16-7.2-16-16V192c0-8.8 7.2-16 16-16H96V128H64z", ], "iconName": "copy", "prefix": "far", @@ -92,6 +92,8 @@ exports[`Collapsible Course Run renders correctly variant_id field for external shake={false} size={null} spin={false} + spinPulse={false} + spinReverse={false} swapOpacity={false} symbol={false} title="" @@ -715,15 +717,15 @@ exports[`Collapsible Course Run renders correctly when given a published course className="text-primary ml-2" fade={false} fixedWidth={false} - flip={null} + flip={false} icon={ Object { "icon": Array [ - 512, + 448, 512, Array [], "f0c5", - "M502.6 70.63l-61.25-61.25C435.4 3.371 427.2 0 418.7 0H255.1c-35.35 0-64 28.66-64 64l.0195 256C192 355.4 220.7 384 256 384h192c35.2 0 64-28.8 64-64V93.25C512 84.77 508.6 76.63 502.6 70.63zM464 320c0 8.836-7.164 16-16 16H255.1c-8.838 0-16-7.164-16-16L239.1 64.13c0-8.836 7.164-16 16-16h128L384 96c0 17.67 14.33 32 32 32h47.1V320zM272 448c0 8.836-7.164 16-16 16H63.1c-8.838 0-16-7.164-16-16L47.98 192.1c0-8.836 7.164-16 16-16H160V128H63.99c-35.35 0-64 28.65-64 64l.0098 256C.002 483.3 28.66 512 64 512h192c35.2 0 64-28.8 64-64v-32h-47.1L272 448z", + "M384 336H192c-8.8 0-16-7.2-16-16V64c0-8.8 7.2-16 16-16l140.1 0L400 115.9V320c0 8.8-7.2 16-16 16zM192 384H384c35.3 0 64-28.7 64-64V115.9c0-12.7-5.1-24.9-14.1-33.9L366.1 14.1c-9-9-21.2-14.1-33.9-14.1H192c-35.3 0-64 28.7-64 64V320c0 35.3 28.7 64 64 64zM64 128c-35.3 0-64 28.7-64 64V448c0 35.3 28.7 64 64 64H256c35.3 0 64-28.7 64-64V416H272v32c0 8.8-7.2 16-16 16H64c-8.8 0-16-7.2-16-16V192c0-8.8 7.2-16 16-16H96V128H64z", ], "iconName": "copy", "prefix": "far", @@ -740,6 +742,8 @@ exports[`Collapsible Course Run renders correctly when given a published course shake={false} size={null} spin={false} + spinPulse={false} + spinReverse={false} swapOpacity={false} symbol={false} title="" @@ -1329,15 +1333,15 @@ exports[`Collapsible Course Run renders correctly when given an unpublished cour className="text-primary ml-2" fade={false} fixedWidth={false} - flip={null} + flip={false} icon={ Object { "icon": Array [ - 512, + 448, 512, Array [], "f0c5", - "M502.6 70.63l-61.25-61.25C435.4 3.371 427.2 0 418.7 0H255.1c-35.35 0-64 28.66-64 64l.0195 256C192 355.4 220.7 384 256 384h192c35.2 0 64-28.8 64-64V93.25C512 84.77 508.6 76.63 502.6 70.63zM464 320c0 8.836-7.164 16-16 16H255.1c-8.838 0-16-7.164-16-16L239.1 64.13c0-8.836 7.164-16 16-16h128L384 96c0 17.67 14.33 32 32 32h47.1V320zM272 448c0 8.836-7.164 16-16 16H63.1c-8.838 0-16-7.164-16-16L47.98 192.1c0-8.836 7.164-16 16-16H160V128H63.99c-35.35 0-64 28.65-64 64l.0098 256C.002 483.3 28.66 512 64 512h192c35.2 0 64-28.8 64-64v-32h-47.1L272 448z", + "M384 336H192c-8.8 0-16-7.2-16-16V64c0-8.8 7.2-16 16-16l140.1 0L400 115.9V320c0 8.8-7.2 16-16 16zM192 384H384c35.3 0 64-28.7 64-64V115.9c0-12.7-5.1-24.9-14.1-33.9L366.1 14.1c-9-9-21.2-14.1-33.9-14.1H192c-35.3 0-64 28.7-64 64V320c0 35.3 28.7 64 64 64zM64 128c-35.3 0-64 28.7-64 64V448c0 35.3 28.7 64 64 64H256c35.3 0 64-28.7 64-64V416H272v32c0 8.8-7.2 16-16 16H64c-8.8 0-16-7.2-16-16V192c0-8.8 7.2-16 16-16H96V128H64z", ], "iconName": "copy", "prefix": "far", @@ -1354,6 +1358,8 @@ exports[`Collapsible Course Run renders correctly when given an unpublished cour shake={false} size={null} spin={false} + spinPulse={false} + spinReverse={false} swapOpacity={false} symbol={false} title="" @@ -1943,15 +1949,15 @@ exports[`Collapsible Course Run renders correctly when submitting for review 1`] className="text-primary ml-2" fade={false} fixedWidth={false} - flip={null} + flip={false} icon={ Object { "icon": Array [ - 512, + 448, 512, Array [], "f0c5", - "M502.6 70.63l-61.25-61.25C435.4 3.371 427.2 0 418.7 0H255.1c-35.35 0-64 28.66-64 64l.0195 256C192 355.4 220.7 384 256 384h192c35.2 0 64-28.8 64-64V93.25C512 84.77 508.6 76.63 502.6 70.63zM464 320c0 8.836-7.164 16-16 16H255.1c-8.838 0-16-7.164-16-16L239.1 64.13c0-8.836 7.164-16 16-16h128L384 96c0 17.67 14.33 32 32 32h47.1V320zM272 448c0 8.836-7.164 16-16 16H63.1c-8.838 0-16-7.164-16-16L47.98 192.1c0-8.836 7.164-16 16-16H160V128H63.99c-35.35 0-64 28.65-64 64l.0098 256C.002 483.3 28.66 512 64 512h192c35.2 0 64-28.8 64-64v-32h-47.1L272 448z", + "M384 336H192c-8.8 0-16-7.2-16-16V64c0-8.8 7.2-16 16-16l140.1 0L400 115.9V320c0 8.8-7.2 16-16 16zM192 384H384c35.3 0 64-28.7 64-64V115.9c0-12.7-5.1-24.9-14.1-33.9L366.1 14.1c-9-9-21.2-14.1-33.9-14.1H192c-35.3 0-64 28.7-64 64V320c0 35.3 28.7 64 64 64zM64 128c-35.3 0-64 28.7-64 64V448c0 35.3 28.7 64 64 64H256c35.3 0 64-28.7 64-64V416H272v32c0 8.8-7.2 16-16 16H64c-8.8 0-16-7.2-16-16V192c0-8.8 7.2-16 16-16H96V128H64z", ], "iconName": "copy", "prefix": "far", @@ -1968,6 +1974,8 @@ exports[`Collapsible Course Run renders correctly when submitting for review 1`] shake={false} size={null} spin={false} + spinPulse={false} + spinReverse={false} swapOpacity={false} symbol={false} title="" @@ -2557,15 +2565,15 @@ exports[`Collapsible Course Run renders correctly when submitting for review and className="text-primary ml-2" fade={false} fixedWidth={false} - flip={null} + flip={false} icon={ Object { "icon": Array [ - 512, + 448, 512, Array [], "f0c5", - "M502.6 70.63l-61.25-61.25C435.4 3.371 427.2 0 418.7 0H255.1c-35.35 0-64 28.66-64 64l.0195 256C192 355.4 220.7 384 256 384h192c35.2 0 64-28.8 64-64V93.25C512 84.77 508.6 76.63 502.6 70.63zM464 320c0 8.836-7.164 16-16 16H255.1c-8.838 0-16-7.164-16-16L239.1 64.13c0-8.836 7.164-16 16-16h128L384 96c0 17.67 14.33 32 32 32h47.1V320zM272 448c0 8.836-7.164 16-16 16H63.1c-8.838 0-16-7.164-16-16L47.98 192.1c0-8.836 7.164-16 16-16H160V128H63.99c-35.35 0-64 28.65-64 64l.0098 256C.002 483.3 28.66 512 64 512h192c35.2 0 64-28.8 64-64v-32h-47.1L272 448z", + "M384 336H192c-8.8 0-16-7.2-16-16V64c0-8.8 7.2-16 16-16l140.1 0L400 115.9V320c0 8.8-7.2 16-16 16zM192 384H384c35.3 0 64-28.7 64-64V115.9c0-12.7-5.1-24.9-14.1-33.9L366.1 14.1c-9-9-21.2-14.1-33.9-14.1H192c-35.3 0-64 28.7-64 64V320c0 35.3 28.7 64 64 64zM64 128c-35.3 0-64 28.7-64 64V448c0 35.3 28.7 64 64 64H256c35.3 0 64-28.7 64-64V416H272v32c0 8.8-7.2 16-16 16H64c-8.8 0-16-7.2-16-16V192c0-8.8 7.2-16 16-16H96V128H64z", ], "iconName": "copy", "prefix": "far", @@ -2582,6 +2590,8 @@ exports[`Collapsible Course Run renders correctly when submitting for review and shake={false} size={null} spin={false} + spinPulse={false} + spinReverse={false} swapOpacity={false} symbol={false} title="" @@ -3171,15 +3181,15 @@ exports[`Collapsible Course Run renders correctly with a course run type 1`] = ` className="text-primary ml-2" fade={false} fixedWidth={false} - flip={null} + flip={false} icon={ Object { "icon": Array [ - 512, + 448, 512, Array [], "f0c5", - "M502.6 70.63l-61.25-61.25C435.4 3.371 427.2 0 418.7 0H255.1c-35.35 0-64 28.66-64 64l.0195 256C192 355.4 220.7 384 256 384h192c35.2 0 64-28.8 64-64V93.25C512 84.77 508.6 76.63 502.6 70.63zM464 320c0 8.836-7.164 16-16 16H255.1c-8.838 0-16-7.164-16-16L239.1 64.13c0-8.836 7.164-16 16-16h128L384 96c0 17.67 14.33 32 32 32h47.1V320zM272 448c0 8.836-7.164 16-16 16H63.1c-8.838 0-16-7.164-16-16L47.98 192.1c0-8.836 7.164-16 16-16H160V128H63.99c-35.35 0-64 28.65-64 64l.0098 256C.002 483.3 28.66 512 64 512h192c35.2 0 64-28.8 64-64v-32h-47.1L272 448z", + "M384 336H192c-8.8 0-16-7.2-16-16V64c0-8.8 7.2-16 16-16l140.1 0L400 115.9V320c0 8.8-7.2 16-16 16zM192 384H384c35.3 0 64-28.7 64-64V115.9c0-12.7-5.1-24.9-14.1-33.9L366.1 14.1c-9-9-21.2-14.1-33.9-14.1H192c-35.3 0-64 28.7-64 64V320c0 35.3 28.7 64 64 64zM64 128c-35.3 0-64 28.7-64 64V448c0 35.3 28.7 64 64 64H256c35.3 0 64-28.7 64-64V416H272v32c0 8.8-7.2 16-16 16H64c-8.8 0-16-7.2-16-16V192c0-8.8 7.2-16 16-16H96V128H64z", ], "iconName": "copy", "prefix": "far", @@ -3196,6 +3206,8 @@ exports[`Collapsible Course Run renders correctly with a course run type 1`] = ` shake={false} size={null} spin={false} + spinPulse={false} + spinReverse={false} swapOpacity={false} symbol={false} title="" @@ -3797,15 +3809,15 @@ exports[`Collapsible Course Run renders correctly with external key field enable className="text-primary ml-2" fade={false} fixedWidth={false} - flip={null} + flip={false} icon={ Object { "icon": Array [ - 512, + 448, 512, Array [], "f0c5", - "M502.6 70.63l-61.25-61.25C435.4 3.371 427.2 0 418.7 0H255.1c-35.35 0-64 28.66-64 64l.0195 256C192 355.4 220.7 384 256 384h192c35.2 0 64-28.8 64-64V93.25C512 84.77 508.6 76.63 502.6 70.63zM464 320c0 8.836-7.164 16-16 16H255.1c-8.838 0-16-7.164-16-16L239.1 64.13c0-8.836 7.164-16 16-16h128L384 96c0 17.67 14.33 32 32 32h47.1V320zM272 448c0 8.836-7.164 16-16 16H63.1c-8.838 0-16-7.164-16-16L47.98 192.1c0-8.836 7.164-16 16-16H160V128H63.99c-35.35 0-64 28.65-64 64l.0098 256C.002 483.3 28.66 512 64 512h192c35.2 0 64-28.8 64-64v-32h-47.1L272 448z", + "M384 336H192c-8.8 0-16-7.2-16-16V64c0-8.8 7.2-16 16-16l140.1 0L400 115.9V320c0 8.8-7.2 16-16 16zM192 384H384c35.3 0 64-28.7 64-64V115.9c0-12.7-5.1-24.9-14.1-33.9L366.1 14.1c-9-9-21.2-14.1-33.9-14.1H192c-35.3 0-64 28.7-64 64V320c0 35.3 28.7 64 64 64zM64 128c-35.3 0-64 28.7-64 64V448c0 35.3 28.7 64 64 64H256c35.3 0 64-28.7 64-64V416H272v32c0 8.8-7.2 16-16 16H64c-8.8 0-16-7.2-16-16V192c0-8.8 7.2-16 16-16H96V128H64z", ], "iconName": "copy", "prefix": "far", @@ -3822,6 +3834,8 @@ exports[`Collapsible Course Run renders correctly with external key field enable shake={false} size={null} spin={false} + spinPulse={false} + spinReverse={false} swapOpacity={false} symbol={false} title="" @@ -4447,15 +4461,15 @@ exports[`Collapsible Course Run renders correctly with no fields 1`] = ` className="text-primary ml-2" fade={false} fixedWidth={false} - flip={null} + flip={false} icon={ Object { "icon": Array [ - 512, + 448, 512, Array [], "f0c5", - "M502.6 70.63l-61.25-61.25C435.4 3.371 427.2 0 418.7 0H255.1c-35.35 0-64 28.66-64 64l.0195 256C192 355.4 220.7 384 256 384h192c35.2 0 64-28.8 64-64V93.25C512 84.77 508.6 76.63 502.6 70.63zM464 320c0 8.836-7.164 16-16 16H255.1c-8.838 0-16-7.164-16-16L239.1 64.13c0-8.836 7.164-16 16-16h128L384 96c0 17.67 14.33 32 32 32h47.1V320zM272 448c0 8.836-7.164 16-16 16H63.1c-8.838 0-16-7.164-16-16L47.98 192.1c0-8.836 7.164-16 16-16H160V128H63.99c-35.35 0-64 28.65-64 64l.0098 256C.002 483.3 28.66 512 64 512h192c35.2 0 64-28.8 64-64v-32h-47.1L272 448z", + "M384 336H192c-8.8 0-16-7.2-16-16V64c0-8.8 7.2-16 16-16l140.1 0L400 115.9V320c0 8.8-7.2 16-16 16zM192 384H384c35.3 0 64-28.7 64-64V115.9c0-12.7-5.1-24.9-14.1-33.9L366.1 14.1c-9-9-21.2-14.1-33.9-14.1H192c-35.3 0-64 28.7-64 64V320c0 35.3 28.7 64 64 64zM64 128c-35.3 0-64 28.7-64 64V448c0 35.3 28.7 64 64 64H256c35.3 0 64-28.7 64-64V416H272v32c0 8.8-7.2 16-16 16H64c-8.8 0-16-7.2-16-16V192c0-8.8 7.2-16 16-16H96V128H64z", ], "iconName": "copy", "prefix": "far", @@ -4472,6 +4486,8 @@ exports[`Collapsible Course Run renders correctly with no fields 1`] = ` shake={false} size={null} spin={false} + spinPulse={false} + spinReverse={false} swapOpacity={false} symbol={false} title="" diff --git a/src/data/actions/courseInfo.js b/src/data/actions/courseInfo.js index e8d3c1a3b..fefa72db9 100644 --- a/src/data/actions/courseInfo.js +++ b/src/data/actions/courseInfo.js @@ -102,6 +102,7 @@ function updateFormValuesAfterSave(change, currentFormValues, initialValues) { 4. url_slug: Auto-generated on backend if not provided 5. tags: To maintain ordering returned by the backend 6. in_year_value: each dict key has default backend value which is not read by form unless changed. + 7. additional_metadata.certificate_info: exec-ed courses needs it and is not read by form unless changed. */ return (dispatch) => { const { @@ -118,6 +119,12 @@ function updateFormValuesAfterSave(change, currentFormValues, initialValues) { per_click_usa: perClickUSA, per_click_international: perClicknternational, }, + additional_metadata: { + certificate_info: { + heading, + blurb, + }, + }, } = initialValues; // This emits a redux action called CHANGE that will update: @@ -131,6 +138,8 @@ function updateFormValuesAfterSave(change, currentFormValues, initialValues) { change('in_year_value.per_lead_international', perLeadInternational); change('in_year_value.per_click_usa', perClickUSA); change('in_year_value.per_click_international', perClicknternational); + change('additional_metadata.certificate_info.heading', heading); + change('additional_metadata.certificate_info.blurb', blurb); for (let i = 0; i < initialCourseRuns.length; i += 1) { change(`course_runs[${i}].status`, initialCourseRuns[i].status); change(`course_runs[${i}].transcript_languages`, initialCourseRuns[i].transcript_languages); diff --git a/src/data/actions/courseInfo.test.js b/src/data/actions/courseInfo.test.js index 81a37d7ee..8e1a140bc 100644 --- a/src/data/actions/courseInfo.test.js +++ b/src/data/actions/courseInfo.test.js @@ -204,6 +204,12 @@ describe('courseInfo edit course actions', () => { per_click_usa: 25, per_click_international: 30, }, + additional_metadata: { + certificate_info: { + heading: 'Test Certificate', + blurb: 'test blurb', + }, + }, imageSrc: 'http://updated.image.src/woo.small', course_runs: [ { @@ -224,8 +230,10 @@ describe('courseInfo edit course actions', () => { expect(changeMock).toHaveBeenNthCalledWith(8, 'in_year_value.per_lead_international', 20); expect(changeMock).toHaveBeenNthCalledWith(9, 'in_year_value.per_click_usa', 25); expect(changeMock).toHaveBeenNthCalledWith(10, 'in_year_value.per_click_international', 30); - expect(changeMock).toHaveBeenNthCalledWith(11, 'course_runs[0].status', 'published'); - expect(changeMock).toHaveBeenNthCalledWith(12, 'course_runs[0].transcript_languages', ['en-us']); + expect(changeMock).toHaveBeenNthCalledWith(11, 'additional_metadata.certificate_info.heading', 'Test Certificate'); + expect(changeMock).toHaveBeenNthCalledWith(12, 'additional_metadata.certificate_info.blurb', 'test blurb'); + expect(changeMock).toHaveBeenNthCalledWith(13, 'course_runs[0].status', 'published'); + expect(changeMock).toHaveBeenNthCalledWith(14, 'course_runs[0].transcript_languages', ['en-us']); }); });