aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/unit/datepicker/events.js10
-rw-r--r--ui/widgets/datepicker.js12
2 files changed, 15 insertions, 7 deletions
diff --git a/tests/unit/datepicker/events.js b/tests/unit/datepicker/events.js
index 05ae7ed4d..76615084c 100644
--- a/tests/unit/datepicker/events.js
+++ b/tests/unit/datepicker/events.js
@@ -44,18 +44,19 @@ QUnit.test( "beforeOpen", function( assert ) {
} );
QUnit.test( "change", function( assert ) {
- assert.expect( 4 );
+ assert.expect( 6 );
var shouldFire;
this.element.datepicker( {
- change: function( event ) {
+ change: function( event, ui ) {
assert.ok( shouldFire, "change event fired" );
assert.equal(
event.type,
"datepickerchange",
"change event"
);
+ assert.equal( $.type( ui.value ), "date", "value is a date object" );
}
} );
@@ -121,19 +122,20 @@ QUnit.test( "open", function( assert ) {
QUnit.test( "select", function( assert ) {
var ready = assert.async();
- assert.expect( 4 );
+ assert.expect( 6 );
var message = "",
that = this;
this.element.datepicker( {
- select: function( event ) {
+ select: function( event, ui ) {
assert.ok( true, "select event fired " + message );
assert.equal(
event.originalEvent.type,
"calendarselect",
"select originalEvent " + message
);
+ assert.equal( $.type( ui.value ), "date", "value is a date object" );
}
} );
diff --git a/ui/widgets/datepicker.js b/ui/widgets/datepicker.js
index b489fe9b7..1325434d3 100644
--- a/ui/widgets/datepicker.js
+++ b/ui/widgets/datepicker.js
@@ -111,14 +111,18 @@ var widget = $.widget( "ui.datepicker", {
.calendar( $.extend( {}, this.options, {
value: this._parse( this.element.val() ),
change: function( event ) {
- that._trigger( "change", event );
+ that._trigger( "change", event, {
+ value: that.calendarInstance.valueAsDate()
+ } );
},
select: function( event ) {
that.element.val( that.calendarInstance.value() );
that.close();
event.preventDefault();
that._focusTrigger();
- that._trigger( "select", event );
+ that._trigger( "select", event, {
+ value: that.calendarInstance.valueAsDate()
+ } );
return false;
}
@@ -183,7 +187,9 @@ var widget = $.widget( "ui.datepicker", {
this.suppressExpandOnFocus = false;
},
change: function( event ) {
- this._trigger( "change", event );
+ this._trigger( "change", event, {
+ value: this.calendarInstance.valueAsDate()
+ } );
}
},