mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
510ba08cff
Add calendar widget by copying and renaming datepicker widget files. Remove datepicker functionality, options and methods from Calendar. Remove calendar functionality, options and methods from Datepicker. Adjust tests due to split and changed specification. Remove duplicated demo files and fix some demos. Simplify calendar generation, use CSS instead of inline styles. Fix destroy method. Make use of uniqueId method. Fix focus highlighting when month is changed. Add version property. Add common unit tests. Fix input keyboard handling.
23 lines
706 B
JavaScript
23 lines
706 B
JavaScript
TestHelpers.calendar = {
|
|
addMonths: function( date, offset ) {
|
|
var maxDay = 32 - new Date( date.getFullYear(), date.getMonth() + offset, 32 ).getDate();
|
|
date.setDate( Math.min( date.getDate(), maxDay ) );
|
|
date.setMonth( date.getMonth() + offset );
|
|
return date;
|
|
},
|
|
equalsDate: function( d1, d2, message ) {
|
|
if ( !d1 || !d2 ) {
|
|
ok( false, message + " - missing date" );
|
|
return;
|
|
}
|
|
d1 = new Date( d1.getFullYear(), d1.getMonth(), d1.getDate() );
|
|
d2 = new Date( d2.getFullYear(), d2.getMonth(), d2.getDate() );
|
|
equal( d1.toString(), d2.toString(), message );
|
|
},
|
|
focusGrid: function( element ) {
|
|
element.find( "table:tabbable" ).simulate( "focus" );
|
|
|
|
return $( ":focus" );
|
|
}
|
|
};
|