Skip to content
Snippets Groups Projects
Commit a29a118c authored by Renzo Lucioni's avatar Renzo Lucioni
Browse files

Only allow enrollment in published runs on the program detail page

Course runs indicated to be upcoming are also restricted to those runs that are published.

LEARNER-942
parent cfc0dc1a
No related merge requests found
......@@ -63,7 +63,8 @@
rawCourseRuns = _.where(this.context.course_runs, {
is_enrollment_open: true,
is_enrolled: false,
is_course_ended: false
is_course_ended: false,
status: 'published'
});
// Deep copy to avoid mutating this.context.
......@@ -90,7 +91,8 @@
return _.where(this.context.course_runs, {
is_enrollment_open: false,
is_enrolled: false,
is_course_ended: false
is_course_ended: false,
status: 'published'
});
},
......
......@@ -61,6 +61,7 @@ define([
is_course_ended: false,
is_enrolled: true,
is_enrollment_open: true,
status: 'published',
upgrade_url: ''
}
]
......
......@@ -57,6 +57,7 @@ define([
is_course_ended: false,
is_enrolled: false,
is_enrollment_open: true,
status: 'published',
upgrade_url: ''
}];
......@@ -80,7 +81,8 @@ define([
enrollment_open_date: 'Jan 18, 2016',
is_course_ended: false,
is_enrolled: false,
is_enrollment_open: true
is_enrollment_open: true,
status: 'published'
}, {
key: 'course-v1:WageningenX+FFESx+1T2017',
uuid: '2f2edf03-79e6-4e39-aef0-65436a6ee344',
......@@ -99,7 +101,8 @@ define([
enrollment_open_date: 'Jan 18, 2016',
is_course_ended: false,
is_enrolled: false,
is_enrollment_open: true
is_enrollment_open: true,
status: 'published'
}];
});
......@@ -150,7 +153,6 @@ define([
it('should not render anything if course runs are empty', function() {
setupView([]);
expect(view.$('.enrollment-info').length).toBe(0);
expect(view.$('.run-select').length).toBe(0);
expect(view.$('.enroll-button').length).toBe(0);
});
......@@ -163,6 +165,22 @@ define([
expect(view.$('.run-select option').length).toBe(2);
});
it('should not allow enrollment in unpublished course runs', function() {
multiCourseRunList[0].status = 'unpublished';
setupView(multiCourseRunList);
expect(view.$('.run-select').length).toBe(0);
expect(view.$('.enroll-button').length).toBe(1);
});
it('should not allow enrollment in course runs with a null status', function() {
multiCourseRunList[0].status = null;
setupView(multiCourseRunList);
expect(view.$('.run-select').length).toBe(0);
expect(view.$('.enroll-button').length).toBe(1);
});
it('should enroll learner when enroll button is clicked with one course run available', function() {
setupView(singleCourseRunList);
......
......@@ -187,7 +187,8 @@ define([
modified: '2017-03-24T14:22:15.609907Z',
is_enrolled: true,
pacing_type: 'self_paced',
video: null
video: null,
status: 'published'
}
]
}
......@@ -268,7 +269,8 @@ define([
modified: '2017-03-24T14:16:47.547643Z',
is_enrolled: true,
pacing_type: 'instructor_paced',
video: null
video: null,
status: 'published'
}
]
}
......@@ -372,7 +374,8 @@ define([
modified: '2017-03-24T14:18:08.693748Z',
is_enrolled: false,
pacing_type: 'instructor_paced',
video: null
video: null,
status: 'published'
},
{
upgrade_url: null,
......@@ -445,7 +448,8 @@ define([
modified: '2017-03-23T16:47:37.108260Z',
is_enrolled: false,
pacing_type: 'self_paced',
video: null
video: null,
status: 'published'
}
]
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment