Calendar: Remove option method overwrite

This commit is contained in:
Felix Nagel 2014-11-07 18:10:31 +01:00 committed by Scott González
parent 32891588f4
commit ee83c37e0f
2 changed files with 5 additions and 11 deletions

View File

@ -55,7 +55,7 @@ test( "valueAsDate", function() {
var minDate, maxDate, dateAndTimeToSet, dateAndTimeClone, var minDate, maxDate, dateAndTimeToSet, dateAndTimeClone,
element = $( "#calendar" ).calendar(), element = $( "#calendar" ).calendar(),
date1 = new Date( 2008, 6 - 1, 4 ), date1 = new Date( 2008, 6 - 1, 4 ),
date2 = new Date(); date2;
element.calendar( "valueAsDate", new Date( 2014, 0, 1 ) ); element.calendar( "valueAsDate", new Date( 2014, 0, 1 ) );
ok( element.find( "a[data-timestamp]:first" ).hasClass( "ui-state-active" ), "First day marked as selected" ); 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( "destroy" );
element.calendar(); element.calendar();
TestHelpers.calendar.equalsDate( element.calendar( "valueAsDate" ), date2, "Set date - default" ); equal( element.calendar( "valueAsDate" ), null, "Set date - default" );
element.calendar( "valueAsDate", date1 ); element.calendar( "valueAsDate", date1 );
TestHelpers.calendar.equalsDate(element.calendar( "valueAsDate" ), date1, "Set date - 2008-06-04" ); TestHelpers.calendar.equalsDate(element.calendar( "valueAsDate" ), date1, "Set date - 2008-06-04" );

View File

@ -486,7 +486,7 @@ return $.widget( "ui.calendar", {
if ( arguments.length ) { if ( arguments.length ) {
this._setOption( "value", value ); this._setOption( "value", value );
} else { } else {
return this.option( "value" ); return this.options.value;
} }
}, },
@ -519,20 +519,14 @@ return $.widget( "ui.calendar", {
.empty(); .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 ) { _setOption: function( key, value ) {
if ( key === "value" ) { if ( key === "value" ) {
if ( this._isValid( value ) ) { if ( this._isValid( value ) ) {
this.date.setTime( value.getTime() ).select(); this.date.setTime( value.getTime() ).select();
this._super( key, value );
this.refresh(); this.refresh();
} }
return;
} }
if ( key === "max" || key === "min" ) { if ( key === "max" || key === "min" ) {