diff --git a/tests/unit/calendar/calendar_methods.js b/tests/unit/calendar/calendar_methods.js index 7588b395b..c7b7bf8dc 100644 --- a/tests/unit/calendar/calendar_methods.js +++ b/tests/unit/calendar/calendar_methods.js @@ -55,7 +55,7 @@ test( "valueAsDate", function() { var minDate, maxDate, dateAndTimeToSet, dateAndTimeClone, element = $( "#calendar" ).calendar(), date1 = new Date( 2008, 6 - 1, 4 ), - date2 = new Date(); + date2; element.calendar( "valueAsDate", new Date( 2014, 0, 1 ) ); ok( element.find( "a[data-timestamp]:first" ).hasClass( "ui-state-active" ), "First day marked as selected" ); @@ -64,7 +64,7 @@ test( "valueAsDate", function() { element.calendar( "destroy" ); element.calendar(); - TestHelpers.calendar.equalsDate( element.calendar( "valueAsDate" ), date2, "Set date - default" ); + equal( element.calendar( "valueAsDate" ), null, "Set date - default" ); element.calendar( "valueAsDate", date1 ); TestHelpers.calendar.equalsDate(element.calendar( "valueAsDate" ), date1, "Set date - 2008-06-04" ); diff --git a/ui/calendar.js b/ui/calendar.js index 89b4e527c..6d4a23d21 100644 --- a/ui/calendar.js +++ b/ui/calendar.js @@ -486,7 +486,7 @@ return $.widget( "ui.calendar", { if ( arguments.length ) { this._setOption( "value", value ); } else { - return this.option( "value" ); + return this.options.value; } }, @@ -519,20 +519,14 @@ return $.widget( "ui.calendar", { .empty(); }, - option: function( key ) { - if ( arguments.length === 0 || ( arguments.length === 1 && key === "value" ) ) { - this.options.value = this.date.selectedDate(); - } - - return this._superApply( arguments ); - }, - _setOption: function( key, value ) { if ( key === "value" ) { if ( this._isValid( value ) ) { this.date.setTime( value.getTime() ).select(); + this._super( key, value ); this.refresh(); } + return; } if ( key === "max" || key === "min" ) {