diff --git a/src/components/EditCoursePage/EditCourseForm.jsx b/src/components/EditCoursePage/EditCourseForm.jsx index 85e3c944d..12b94d2d8 100644 --- a/src/components/EditCoursePage/EditCourseForm.jsx +++ b/src/components/EditCoursePage/EditCourseForm.jsx @@ -268,7 +268,7 @@ export class BaseEditCourseForm extends React.Component { const { data: { - results: allResults, + results: allResults = [], }, } = collaboratorOptions; diff --git a/src/components/EditCoursePage/EditCourseForm.test.jsx b/src/components/EditCoursePage/EditCourseForm.test.jsx index 9077b5b97..840da6048 100644 --- a/src/components/EditCoursePage/EditCourseForm.test.jsx +++ b/src/components/EditCoursePage/EditCourseForm.test.jsx @@ -474,4 +474,24 @@ describe('BaseEditCourseForm', () => { const fields = component.find({ name: 'imageSrc' }); expect(fields).toHaveLength(1); }); + + it('renders html correctly while fetching collaborator options', () => { + const component = shallow( null} + initialValues={{ + title: initialValuesFull.title, + }} + title={initialValuesFull.title} + number="Test101x" + courseStatuses={[UNPUBLISHED]} + courseInfo={courseInfo} + courseOptions={courseOptions} + courseRunOptions={courseRunOptions} + uuid={initialValuesFull.uuid} + type={initialValuesFull.type} + id="edit-course-form" + collaboratorOptions={{ data: {} }} + />); + expect(shallowToJson(component)).toMatchSnapshot(); + }); }); diff --git a/src/components/EditCoursePage/__snapshots__/EditCourseForm.test.jsx.snap b/src/components/EditCoursePage/__snapshots__/EditCourseForm.test.jsx.snap index ea72d10b9..b9e73a2e9 100644 --- a/src/components/EditCoursePage/__snapshots__/EditCourseForm.test.jsx.snap +++ b/src/components/EditCoursePage/__snapshots__/EditCourseForm.test.jsx.snap @@ -3700,6 +3700,1391 @@ exports[`BaseEditCourseForm renders correctly when submitting for review 1`] = ` `; +exports[`BaseEditCourseForm renders html correctly while fetching collaborator options 1`] = ` +
+
+ + + Course: Test Title + +
+ No Preview Link Available +
+ + } + > +
+ + All fields are required for publication unless otherwise specified. + +
+ +

+ Maximum 70 characters. Recommended 50 or fewer characters. +

+

+ An effective course title: +

+
    +
  • + Clearly indicates the course subject matter. +
  • +
  • + Follows search engine optimization (SEO) guidelines. +
  • +
  • + Targets a global audience. +
  • +
+

+ + Learn more. + +

+

+ + Example: + +

+

+ English Grammar and Essay Writing +

+
+ } + id="title.label" + optional={false} + text="Title" + /> + } + name="title" + required={true} + type="text" + /> + +

+ + Note: Course editors cannot edit the URL slug. Please reach out to your project coordinator or edX support to edit this field. + +

+

+ This field is optional. If left blank, edX will automatically create a URL slug based on the course title. +

+

+ If you find that a given URL slug is already in use, we recommend adding your school or institution name to the slug to ensure uniqueness. +

+

+ This URL slug can be changed, and learners who visit an older URL will be redirected to the current URL. +

+

+ + What is a URL slug? + +

+

+ In the following example URLs: +

+

+ + www.edx.org/course/math-101, the URL slug is “math-101” + +

+ + Using URL slugs that are short and easily understandable helps learners find and remember course pages, and also drives higher rankings in search engine results. + + + } + id="slug.label" + optional={true} + text="URL slug" + /> + } + name="url_slug" + optional={true} + pattern="^[a-z0-9_]+(?:-[a-z0-9_]+)*$" + type="text" + /> + + A list of email addresses that will receive notifications when the course run of the course is published or reviewed. +

+ } + id="watchers.label" + optional={true} + text="Watchers" + /> + } + name="watchers_list" + optional={true} + /> +
+ +

+ The Product source is a key that identifies where the course originates. +

+

+ + Example: + +

+

+ If the course originates from the edX platform, the Product source is edX. +

+
+ } + id="productSource" + optional={false} + text="Product Source" + /> +
+ N/A +
+ +
+ +
+ Test101x +
+
+
+ +
+
+ + + Date: + + + N/A + +
+
+ + Time (UTC): + + + N/A +
+
+
+ +

+ The Course enrollment track determines what enrollment tracks are eligible for the course runs. +

+

+ + Example: + +

+

+ The Verified and Audit selection will allow course runs to either be Verified and Audit or Audit only. +

+ + } + id="type.label" + optional={false} + text="Course enrollment track" + /> + } + name="type" + options={ + [ + { + "label": "Select enrollment track", + "value": "", + }, + { + "label": "Credit", + "value": "9521aa7d-801b-4a67-92c3-716ea30f5086", + }, + { + "label": "Masters Only", + "value": "7b41992e-f268-4331-8ba9-72acb0880454", + }, + { + "label": "Verified and Audit", + "value": "8a8f30e1-23ce-4ed3-a361-1325c656b67b", + }, + { + "label": "Professional Only", + "value": "fdde7d04-7ce0-4ff7-ac90-7f518e90ac1e", + }, + { + "label": "Audit Only", + "value": "03e09c15-4127-4031-bc02-e20fcbdf09f0", + }, + ] + } + /> + + +

+ Course teams are responsible for securing any necessary permissions for use of third-party logos. +

+

+ To elaborate on the support, please include additional information in the “About this course” section. Please avoid including statements that the course is jointly offered or that the 3rd party is collaborating or partnering with edX. +

+ + } + id="collaborators.label" + optional={true} + text="Collaborators" + /> + + +

+ An eye-catching, colorful image that captures the essence of your course. +

+
    +
  • + New course images must be 1134×675 pixels in size. +
  • +
  • + The image must be a JPEG or PNG file. +
  • +
  • + Each course must have a unique image. +
  • +
  • + The image cannot include text or headlines. +
  • +
  • + You must have permission to use the image. Possible image sources include Flickr creative commons, Stock Vault, Stock XCHNG, and iStock Photo. +
  • +
+

+ + Learn more. + +

+ + } + id="image.label" + optional={false} + text="Image" + /> + } + maxImageSizeKilo={1000} + name="imageSrc" + requiredHeight={675} + requiredWidth={1134} + /> + + You can add tags in the format mba-no-gmat,mba,mba_4_modules,mba_NY +

+ } + id="tags.label" + optional={true} + text="Topics" + /> + } + loadOptions={[Function]} + name="tags" + optional={true} + /> +
+ +
+
+ Introductory +
+
+ No prerequisites +
+
+ Intermediate +
+
+ Basic prerequisites +
+
+ Advanced +
+
+ Significant prerequisites +
+
+ + } + id="level.label" + optional={false} + text="Course level" + /> + } + name="level_type" + options={ + [ + { + "label": "--", + "value": "", + }, + { + "label": "Beginner", + "value": "beginner", + }, + { + "label": "Intermediate", + "value": "intermediate", + }, + { + "label": "Advanced", + "value": "advanced", + }, + ] + } + required={false} + /> + +

+ The subject of the course. +

+

+ You can select up to two subjects in addition to the primary subject. Only the primary subject appears on the About page. +

+

+ + Learn more. + +

+ + } + id="subject1.label" + optional={false} + text="Primary subject" + /> + } + name="subjectPrimary" + options={ + [ + { + "label": "--", + "value": "", + }, + { + "label": "Business", + "value": "business", + }, + { + "label": "Chemistry", + "value": "chemistry", + }, + { + "label": "English", + "value": "english", + }, + { + "label": "Security", + "value": "security", + }, + ] + } + required={false} + /> + + } + name="subjectSecondary" + optional={true} + options={ + [ + { + "label": "--", + "value": "", + }, + { + "label": "Business", + "value": "business", + }, + { + "label": "Chemistry", + "value": "chemistry", + }, + { + "label": "English", + "value": "english", + }, + { + "label": "Security", + "value": "security", + }, + ] + } + /> + + } + name="subjectTertiary" + optional={true} + options={ + [ + { + "label": "--", + "value": "", + }, + { + "label": "Business", + "value": "business", + }, + { + "label": "Chemistry", + "value": "chemistry", + }, + { + "label": "English", + "value": "english", + }, + { + "label": "Security", + "value": "security", + }, + ] + } + /> + + } + name="organization_short_code_override" + optional={true} + /> + + } + maxImageSizeKilo={256} + name="organization_logo_override_url" + optional={true} + requiredHeight={110} + requiredWidth={110} + /> + + + + + + + +`; + exports[`BaseEditCourseForm renders html correctly while submitting 1`] = `