fix course creation message. fixes #6854

affects: course creation on /accounts/:id
test plan:
  * navigate to courses page for account;
  * click 'Add a New Course' button;
  * fill out new course form and click 'Add Course';
  * verify that (1) modal closes, and (2) flash message
    appears.

Change-Id: Idce434d288dd8b81a29edfd1b5144c0dcedfc7ea
Reviewed-on: https://gerrit.instructure.com/8032
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Ryan Florence <ryanf@instructure.com>
This commit is contained in:
Zach Pendleton 2012-01-12 11:26:23 -07:00
parent 0399355a78
commit 54fc56e36d
2 changed files with 17 additions and 4 deletions

View File

@ -165,7 +165,7 @@
success: function(data) {
$(this).find("button").attr('disabled', false)
.filter(".submit_button").text(I18n.t('add_course_button', "Add Course"));
var course = data.course;
var course = data;
if(course.enrollment_term_id == parseInt($("#current_enrollment_term_id").text(), 10)) {
var $course = $("#course_blank").clone(true);
var course_data = {id: course.id};

View File

@ -120,17 +120,30 @@ describe "account authentication configs" do
dialog = driver.find_element(:id, "add_user_dialog")
dialog.find_element(:css, 'label[for="pseudonym_unique_id"]').text.should == "CAS Username:"
end
it "should be able to create a new course" do
course_with_admin_logged_in
get "/accounts/#{Account.default.id}"
driver.find_element(:css, '.add_course_link').click
driver.find_element(:css, '#add_course_form input[type=text]:first-child').send_keys('Test Course')
driver.find_element(:id, 'course_course_code').send_keys('TEST001')
driver.find_element(:css, '#add_course_form .submit_button').click
wait_for_ajaximations
driver.find_element(:id, 'add_course_dialog').should_not be_displayed
driver.find_element(:id, 'flash_notice_message').text.should match 'Test Course successfully added!'
end
it "should be able to update term dates" do
course_with_admin_logged_in
def verify_displayed_term_dates(term, dates)
dates.each do |en_type, dates|
term.find_element(:css, ".#{en_type}_dates .start_date .show_term").text.should match /#{dates[0]}/
term.find_element(:css, ".#{en_type}_dates .end_date .show_term").text.should match /#{dates[1]}/
end
end
get "/accounts/#{Account.default.id}/terms"
term = driver.find_element(:css, "tr.term")
term.find_element(:css, ".edit_term_link").click