fix replacing hours/minutes when editing date picker fields; fixes #5903

Change-Id: Ide4048c41bc670004c3915c4c526b980eafed4ac
Reviewed-on: https://gerrit.instructure.com/6121
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: JT Olds <jt@instructure.com>
Reviewed-by: Ryan Shaw <ryan@instructure.com>
This commit is contained in:
Zach Wily 2011-10-10 16:43:12 -06:00
parent 8a5ab4be08
commit 77681054a5
2 changed files with 21 additions and 3 deletions

View File

@ -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);
}
});

View File

@ -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