From ff2d952d3963a0b77e2f02f8bbc51bd458ddad86 Mon Sep 17 00:00:00 2001 From: cahrens Date: Wed, 11 Sep 2013 11:46:59 -0400 Subject: [PATCH] Change course id limit to 65. STUD-726 --- cms/djangoapps/contentstore/features/common.py | 8 +++++++- .../features/course-settings.feature | 2 +- .../contentstore/features/courses.feature | 16 ++++++++++++++++ cms/djangoapps/contentstore/features/courses.py | 10 ++++++++++ .../contentstore/features/grading.feature | 2 +- cms/static/js/base.js | 12 ++++++------ 6 files changed, 41 insertions(+), 9 deletions(-) diff --git a/cms/djangoapps/contentstore/features/common.py b/cms/djangoapps/contentstore/features/common.py index a6f22db340..c5405b1951 100644 --- a/cms/djangoapps/contentstore/features/common.py +++ b/cms/djangoapps/contentstore/features/common.py @@ -232,13 +232,19 @@ def open_new_unit(step): world.css_click('a.new-unit-item') -@step('the save button is disabled$') +@step('the save notification button is disabled') def save_button_disabled(step): button_css = '.action-save' disabled = 'is-disabled' assert world.css_has_class(button_css, disabled) +@step('the "([^"]*)" button is disabled') +def button_disabled(step, value): + button_css = 'input[value="%s"]' % value + assert world.css_has_class(button_css, 'is-disabled') + + @step('I confirm the prompt') def confirm_the_prompt(step): prompt_css = 'a.button.action-primary' diff --git a/cms/djangoapps/contentstore/features/course-settings.feature b/cms/djangoapps/contentstore/features/course-settings.feature index 9976179b68..be457de959 100644 --- a/cms/djangoapps/contentstore/features/course-settings.feature +++ b/cms/djangoapps/contentstore/features/course-settings.feature @@ -87,7 +87,7 @@ Feature: Course Settings Given I have opened a new course in Studio When I select Schedule and Details And I change the "Course Start Date" field to "" - Then the save button is disabled + Then the save notification button is disabled Scenario: User can upload course image Given I have opened a new course in Studio diff --git a/cms/djangoapps/contentstore/features/courses.feature b/cms/djangoapps/contentstore/features/courses.feature index a0ba8099ac..e762d0b8a6 100644 --- a/cms/djangoapps/contentstore/features/courses.feature +++ b/cms/djangoapps/contentstore/features/courses.feature @@ -11,3 +11,19 @@ Feature: Create Course And I press the "Create" button Then the Courseware page has loaded in Studio And I see a link for adding a new section + + Scenario: Error message when org/course/run tuple is too long + Given There are no courses + And I am logged into Studio + When I click the New Course button + And I create a course with "course name", "012345678901234567890123456789", "012345678901234567890123456789", and "0123456" + Then I see an error about the length of the org/course/run tuple + And the "Create" button is disabled + + Scenario: Course name is not included in the "too long" computation + Given There are no courses + And I am logged into Studio + When I click the New Course button + And I create a course with "012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789", "org", "coursenum", and "run" + And I press the "Create" button + Then the Courseware page has loaded in Studio diff --git a/cms/djangoapps/contentstore/features/courses.py b/cms/djangoapps/contentstore/features/courses.py index f18b06ec64..25fd0190b4 100644 --- a/cms/djangoapps/contentstore/features/courses.py +++ b/cms/djangoapps/contentstore/features/courses.py @@ -23,6 +23,11 @@ def i_fill_in_a_new_course_information(step): fill_in_course_info() +@step('I create a course with "([^"]*)", "([^"]*)", "([^"]*)", and "([^"]*)"') +def i_create_course(step, name, org, number, run): + fill_in_course_info(name=name, org=org, num=number, run=run) + + @step('I create a new course$') def i_create_a_course(step): create_a_course() @@ -33,6 +38,11 @@ def i_click_the_course_link_in_my_courses(step): course_css = 'a.course-link' world.css_click(course_css) + +@step('I see an error about the length of the org/course/run tuple') +def i_see_error_about_length(step): + assert world.css_has_text('#course_creation_error', 'The combined length of the organization, course number, and course run fields cannot be more than 65 characters.') + ############ ASSERTIONS ################### diff --git a/cms/djangoapps/contentstore/features/grading.feature b/cms/djangoapps/contentstore/features/grading.feature index 0b34feb7aa..d741af42e2 100644 --- a/cms/djangoapps/contentstore/features/grading.feature +++ b/cms/djangoapps/contentstore/features/grading.feature @@ -86,7 +86,7 @@ Feature: Course Grading And I have populated the course And I am viewing the grading settings When I change assignment type "Homework" to "" - Then the save button is disabled + Then the save notification button is disabled # IE and Safari cannot type in grade range name @skip_internetexplorer diff --git a/cms/static/js/base.js b/cms/static/js/base.js index cfa4b750e6..a6a7103d9f 100644 --- a/cms/static/js/base.js +++ b/cms/static/js/base.js @@ -626,25 +626,25 @@ function addNewCourse(e) { return gettext('Please do not use any spaces or special characters in this field.'); } return ''; - } + }; - // Ensure that all items are less than 80 characters. + // Ensure that org/course_num/run < 65 chars. var validateTotalCourseItemsLength = function() { var totalLength = _.reduce( - ['.new-course-name', '.new-course-org', '.new-course-number', '.new-course-run'], + ['.new-course-org', '.new-course-number', '.new-course-run'], function(sum, ele) { return sum + $(ele).val().length; }, 0 ); - if(totalLength > 80) { + if(totalLength > 65) { $('.wrap-error').addClass('is-shown'); - $('#course_creation_error').html('

' + gettext('Course fields must have a combined length of no more than 80 characters.') + '

'); + $('#course_creation_error').html('

' + gettext('The combined length of the organization, course number, and course run fields cannot be more than 65 characters.') + '

'); $('.new-course-save').addClass('is-disabled'); } else { $('.wrap-error').removeClass('is-shown'); } - } + }; // Handle validation asynchronously _.each(