mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
Datepicker: Update the picker as the user types valid dates
This commit is contained in:
parent
feedc57486
commit
fd215f1863
@ -218,7 +218,7 @@ asyncTest( "baseStructure", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test( "Keyboard handling", function() {
|
test( "Keyboard handling", function() {
|
||||||
expect( 8 );
|
expect( 9 );
|
||||||
var input = $( "#datepicker" ).datepicker(),
|
var input = $( "#datepicker" ).datepicker(),
|
||||||
instance = input.datepicker( "instance" ),
|
instance = input.datepicker( "instance" ),
|
||||||
date = new Date();
|
date = new Date();
|
||||||
@ -260,6 +260,11 @@ test( "Keyboard handling", function() {
|
|||||||
TestHelpers.datepicker.equalsDate( input.datepicker( "valueAsDate" ), new Date( 2014, 0, 1 ),
|
TestHelpers.datepicker.equalsDate( input.datepicker( "valueAsDate" ), new Date( 2014, 0, 1 ),
|
||||||
"Keystroke esc - abandoned" );
|
"Keystroke esc - abandoned" );
|
||||||
|
|
||||||
|
input.val( "1/2/14" )
|
||||||
|
.simulate( "keyup" );
|
||||||
|
TestHelpers.datepicker.equalsDate( input.datepicker( "valueAsDate" ), new Date( 2014, 0, 2 ),
|
||||||
|
"Picker updated as user types into input" );
|
||||||
|
|
||||||
input.datepicker( "destroy" );
|
input.datepicker( "destroy" );
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -232,6 +232,12 @@ $.widget( "ui.datepicker", {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
keyup: function() {
|
||||||
|
if ( this.isValid() && !this.inline ) {
|
||||||
|
this.date.setTime( this.element.val() ).select();
|
||||||
|
this.refresh();
|
||||||
|
}
|
||||||
|
},
|
||||||
mousedown: function( event ) {
|
mousedown: function( event ) {
|
||||||
if (this.isOpen) {
|
if (this.isOpen) {
|
||||||
suppressExpandOnFocus = true;
|
suppressExpandOnFocus = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user