From 160ec0697506f722089e94e6cf5176d2b88d096e Mon Sep 17 00:00:00 2001 From: Syed Muhammad Dawoud Sheraz Ali Date: Fri, 20 Dec 2024 18:10:18 +0500 Subject: [PATCH] temp: disable price edits if course has a published run --- .../EditCoursePage/EditCourseForm.jsx | 4 +++- .../EditCoursePage/EditCourseForm.test.jsx | 21 +++++++++++++++++++ .../EditCourseForm.test.jsx.snap | 8 +++++++ src/containers/MainApp/index.jsx | 5 ++++- 4 files changed, 36 insertions(+), 2 deletions(-) diff --git a/src/components/EditCoursePage/EditCourseForm.jsx b/src/components/EditCoursePage/EditCourseForm.jsx index 12b94d2d8..7b01213d0 100644 --- a/src/components/EditCoursePage/EditCourseForm.jsx +++ b/src/components/EditCoursePage/EditCourseForm.jsx @@ -429,9 +429,11 @@ export class BaseEditCourseForm extends React.Component { disabled={disabled || !!entitlement.sku} /> { expect(disabledFields).toHaveLength(1); }); + it('renders with price disabled if course has Published status among status list', () => { + const component = shallow( null} + title={initialValuesFull.title} + initialValues={initialValuesFull} + currentFormValues={initialValuesFull} + number="Test101x" + entitlement={{ sku: 'ABC1234' }} + courseStatuses={[REVIEWED, PUBLISHED]} + courseInfo={courseInfo} + courseOptions={courseOptions} + courseRunOptions={courseRunOptions} + uuid={initialValuesFull.uuid} + type={initialValuesFull.type} + id="edit-course-form" + />); + + const disabledFields = component.find({ name: 'course_price_list', disabled: true }); + expect(disabledFields).toHaveLength(1); + }); + it('Check if watchers field is disabled after being reviewed', () => { const courseInfoWithCourseRunStatuses = { ...courseInfo, diff --git a/src/components/EditCoursePage/__snapshots__/EditCourseForm.test.jsx.snap b/src/components/EditCoursePage/__snapshots__/EditCourseForm.test.jsx.snap index b9e73a2e9..8538cf195 100644 --- a/src/components/EditCoursePage/__snapshots__/EditCourseForm.test.jsx.snap +++ b/src/components/EditCoursePage/__snapshots__/EditCourseForm.test.jsx.snap @@ -336,6 +336,7 @@ exports[`BaseEditCourseForm override slug format when IS_NEW_SLUG_FORMAT_ENABLED "onInvalid": [Function], } } + name="course_price_list" priceLabels={ { "verified": "Verified", @@ -2183,6 +2184,7 @@ exports[`BaseEditCourseForm renders correctly when submitting for review 1`] = ` "onInvalid": [Function], } } + name="course_price_list" priceLabels={ { "verified": "Verified", @@ -4030,6 +4032,7 @@ exports[`BaseEditCourseForm renders html correctly while fetching collaborator o "onInvalid": [Function], } } + name="course_price_list" priceLabels={{}} required={false} /> @@ -5415,6 +5418,7 @@ exports[`BaseEditCourseForm renders html correctly while submitting 1`] = ` "onInvalid": [Function], } } + name="course_price_list" priceLabels={ { "verified": "Verified", @@ -7303,6 +7307,7 @@ exports[`BaseEditCourseForm renders html correctly with administrator being true "onInvalid": [Function], } } + name="course_price_list" priceLabels={ { "verified": "Verified", @@ -9497,6 +9502,7 @@ exports[`BaseEditCourseForm renders html correctly with all data present 1`] = ` "onInvalid": [Function], } } + name="course_price_list" priceLabels={ { "verified": "Verified", @@ -11385,6 +11391,7 @@ exports[`BaseEditCourseForm renders html correctly with minimal data 1`] = ` "onInvalid": [Function], } } + name="course_price_list" priceLabels={{}} required={false} /> @@ -12774,6 +12781,7 @@ exports[`BaseEditCourseForm renders html correctly with skills data when skills "onInvalid": [Function], } } + name="course_price_list" priceLabels={{}} required={false} /> diff --git a/src/containers/MainApp/index.jsx b/src/containers/MainApp/index.jsx index 85e93a1cc..5a6f650ae 100644 --- a/src/containers/MainApp/index.jsx +++ b/src/containers/MainApp/index.jsx @@ -20,13 +20,16 @@ import SitewideBanner from '../../components/SitewideBanner'; const MainApp = () => (
+ {/* Only display the banner if there is content to display. */} + {process.env.SITEWIDE_BANNER_CONTENT && ( + )}
} />