diff --git a/lms/static/js/spec/learner_dashboard/course_entitlement_view_spec.js b/lms/static/js/spec/learner_dashboard/course_entitlement_view_spec.js index 5239ee6325..c04e935628 100644 --- a/lms/static/js/spec/learner_dashboard/course_entitlement_view_spec.js +++ b/lms/static/js/spec/learner_dashboard/course_entitlement_view_spec.js @@ -10,6 +10,7 @@ define([ describe('Course Entitlement View', function() { var view = null, setupView, + sessionIndex, selectOptions, entitlementAvailableSessions, initialSessionId, @@ -18,17 +19,18 @@ define([ entitlementUUID = 'a9aiuw76a4ijs43u18', testSessionIds = ['test_session_id_1', 'test_session_id_2']; - setupView = function(isAlreadyEnrolled, hasAvailableSessions) { + setupView = function(isAlreadyEnrolled, hasAvailableSessions, specificSessionIndex) { setFixtures('
'); alreadyEnrolled = (typeof isAlreadyEnrolled !== 'undefined') ? isAlreadyEnrolled : true; hasSessions = (typeof hasAvailableSessions !== 'undefined') ? hasAvailableSessions : true; + sessionIndex = (typeof specificSessionIndex !== 'undefined') ? specificSessionIndex : 0; - initialSessionId = alreadyEnrolled ? testSessionIds[0] : ''; + initialSessionId = alreadyEnrolled ? testSessionIds[sessionIndex] : ''; entitlementAvailableSessions = []; if (hasSessions) { entitlementAvailableSessions = [{ enrollment_end: null, - start: '2019-02-05T05:00:00+00:00', + start: '2016-02-05T05:00:00+00:00', pacing_type: 'instructor_paced', session_id: testSessionIds[0], end: null @@ -141,6 +143,17 @@ define([ }); }); + describe('Available Sessions Select - Fulfilled Entitlement (session in the future)', function() { + beforeEach(function() { + setupView(true, true, 1); + }); + + it('Currently selected session should initialize to selected in the dropdown options.', function() { + var selectedOption = view.$('.session-select').find('option:selected'); + expect(selectedOption.data('session_id')).toEqual(testSessionIds[1]); + }); + }); + describe('Select Session Action Button and popover behavior - Unfulfilled Entitlement', function() { beforeEach(function() { setupView(false); diff --git a/lms/templates/learner_dashboard/course_entitlement.underscore b/lms/templates/learner_dashboard/course_entitlement.underscore index 666e67883d..6dee40a8a3 100644 --- a/lms/templates/learner_dashboard/course_entitlement.underscore +++ b/lms/templates/learner_dashboard/course_entitlement.underscore @@ -14,7 +14,7 @@