diff --git a/cms/static/js/spec/views/pages/course_outline_spec.js b/cms/static/js/spec/views/pages/course_outline_spec.js index dfde0ff04d..e617c9fbf3 100644 --- a/cms/static/js/spec/views/pages/course_outline_spec.js +++ b/cms/static/js/spec/views/pages/course_outline_spec.js @@ -727,6 +727,29 @@ define(["jquery", "common/js/spec_helpers/ajax_helpers", "common/js/components/u expect($('.modal-section .advanced-settings-button')).toHaveClass('active'); }); + it('can select valid time', function() { + createCourseOutlinePage(this, mockCourseJSON, false); + outlinePage.$('.outline-subsection .configure-button').click(); + selectAdvancedSettings(); + + var default_time = "00:30"; + var valid_times = ["00:30", "23:00", "24:00", "99:00"]; + var invalid_times = ["00:00", "100:00", "01:60"]; + var time_limit, i; + + for (i = 0; i < valid_times.length; i++){ + time_limit = valid_times[i]; + selectTimedExam(time_limit); + expect($("#id_time_limit").val()).toEqual(time_limit); + } + for (i = 0; i < invalid_times.length; i++){ + time_limit = invalid_times[i]; + selectTimedExam(time_limit); + expect($("#id_time_limit").val()).not.toEqual(time_limit); + expect($("#id_time_limit").val()).toEqual(default_time); + } + }); + it('can be edited', function() { createCourseOutlinePage(this, mockCourseJSON, false); outlinePage.$('.outline-subsection .configure-button').click(); diff --git a/cms/static/js/views/modals/course_outline_modals.js b/cms/static/js/views/modals/course_outline_modals.js index 155255e066..a430607212 100644 --- a/cms/static/js/views/modals/course_outline_modals.js +++ b/cms/static/js/views/modals/course_outline_modals.js @@ -388,7 +388,7 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview', this.$('input.time').timepicker({ 'timeFormat' : 'H:i', 'minTime': '00:30', - 'maxTime': '05:00', + 'maxTime': '24:00', 'forceRoundTime': false }); @@ -429,7 +429,7 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview', this.$('#id_exam_review_rules').val(value); }, isValidTimeLimit: function(time_limit) { - var pattern = new RegExp('^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$'); + var pattern = new RegExp('^\\d{1,2}:[0-5][0-9]$'); return pattern.test(time_limit) && time_limit !== "00:00"; }, getExamTimeLimit: function () { diff --git a/cms/templates/js/timed-examination-preference-editor.underscore b/cms/templates/js/timed-examination-preference-editor.underscore index f9b21cee82..4dc1f3414b 100644 --- a/cms/templates/js/timed-examination-preference-editor.underscore +++ b/cms/templates/js/timed-examination-preference-editor.underscore @@ -55,7 +55,7 @@ value="" aria-describedby="time-limit-description" placeholder="HH:MM" class="time_limit release-time time input input-text" autocomplete="off" /> -

<%- gettext('Learners see warnings when 20% and 5% of the allotted time remains. You can grant learners extra time to complete the exam through the Instructor Dashboard.') %>

+

<%- gettext('Select a time allotment for the exam. If it is over 24 hours, type in the amount of time. You can grant individual learners extra time to complete the exam through the Instructor Dashboard.') %>