From 77681054a5fdcab52aa80c18fe8c9f2f4bca8d49 Mon Sep 17 00:00:00 2001 From: Zach Wily Date: Mon, 10 Oct 2011 16:43:12 -0600 Subject: [PATCH] fix replacing hours/minutes when editing date picker fields; fixes #5903 Change-Id: Ide4048c41bc670004c3915c4c526b980eafed4ac Reviewed-on: https://gerrit.instructure.com/6121 Tested-by: Hudson Reviewed-by: JT Olds Reviewed-by: Ryan Shaw --- .../jquery.instructure_date_and_time.js | 3 --- spec/selenium/jquery_ui_spec.rb | 21 +++++++++++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/public/javascripts/jquery.instructure_date_and_time.js b/public/javascripts/jquery.instructure_date_and_time.js index d316fe3cdde..538496bb281 100644 --- a/public/javascripts/jquery.instructure_date_and_time.js +++ b/public/javascripts/jquery.instructure_date_and_time.js @@ -280,21 +280,18 @@ I18n.scoped('instructure', function(I18n) { var cur = $.datepicker._curInst; if(cur) { var val = $(this).val(); - $(this).val(val); cur.input.data('time-hour', val); } }).delegate(".ui-datepicker-time-minute", 'change keypress focus blur', function(event) { var cur = $.datepicker._curInst; if(cur) { var val = $(this).val(); - $(this).val(val); cur.input.data('time-minute', val); } }).delegate(".ui-datepicker-time-ampm", 'change keypress focus blur', function(event) { var cur = $.datepicker._curInst; if(cur) { var val = $(this).val(); - $(this).val(val); cur.input.data('time-ampm', val); } }); diff --git a/spec/selenium/jquery_ui_spec.rb b/spec/selenium/jquery_ui_spec.rb index c26a22a551d..34515b7b6e4 100644 --- a/spec/selenium/jquery_ui_spec.rb +++ b/spec/selenium/jquery_ui_spec.rb @@ -25,6 +25,27 @@ describe "jquery ui selenium tests" do driver.find_element(:css, ".ui-widget-overlay").should be_displayed end + context "calendar widget" do + it "should let you replace content by selecting and typing instead of appending" do + get "/courses/#{@course.id}/assignments" + + driver.find_element(:css, "a.add_assignment_link").click + wait_for_animations + driver.find_element(:css, ".ui-datepicker-trigger").click + wait_for_animations + driver.find_element(:css, ".ui-datepicker-time-hour").send_keys("12") + driver.find_element(:css, ".ui-datepicker-time-minute").send_keys("00") + driver.find_element(:css, ".ui-datepicker-ok").click + + driver.find_element(:css, ".ui-datepicker-trigger").click + wait_for_animations + + driver.execute_script("$('#ui-datepicker-time-hour').select();") + driver.find_element(:id, "ui-datepicker-time-hour").send_keys('5') + driver.find_element(:id, "ui-datepicker-time-hour").attribute('value').should == "5" + end + end + context "dialog titles" do # jquery ui doesn't escape dialog titles by default (even when inferred from