Commit 0bea1855 by Christina Roberts

Merge pull request #928 from edx/christina/courseid_length

Change course id limit to 65.
parents 2286259b ff2d952d
......@@ -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'
......
......@@ -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
......
......@@ -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
......@@ -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 ###################
......
......@@ -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
......
......@@ -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('<p>' + gettext('Course fields must have a combined length of no more than 80 characters.') + '</p>');
$('#course_creation_error').html('<p>' + gettext('The combined length of the organization, course number, and course run fields cannot be more than 65 characters.') + '</p>');
$('.new-course-save').addClass('is-disabled');
}
else {
$('.wrap-error').removeClass('is-shown');
}
}
};
// Handle validation asynchronously
_.each(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment