});
test( "eachDay", function() {
- expect( 0 );
+ expect( 5 );
+ var timestamp,
+ input = $( "#datepicker" ).datepicker(),
+ picker = input.datepicker( "widget" );
+ firstCell = picker.find( "td[id]:first" );
+
+ equal( firstCell.find( "a" ).length, 1, "days are selectable by default" );
+ timestamp = parseInt( firstCell.find( "a" ).attr( "data-timestamp" ), 10 );
+ equal( new Date( timestamp ).getDate(), 1, "first available day is the 1st by default" );
+
+ // Do not render the 1st of the month
+ input.datepicker( "option", "eachDay", function( day ) {
+ if ( day.date === 1 ) {
+ day.render = false;
+ }
+ });
+ firstCell = picker.find( "td[id]:first" );
+ timestamp = parseInt( firstCell.find( "a" ).attr( "data-timestamp" ), 10 );
+ equal( new Date( timestamp ).getDate(), 2, "first available day is the 2nd" );
+
+ // Display the 1st of the month but make it not selectable.
+ input.datepicker( "option", "eachDay", function( day ) {
+ if ( day.date === 1 ) {
+ day.selectable = false;
+ }
+ });
+ firstCell = picker.find( "td[id]:first" );
+ equal( firstCell.find( "a" ).length, 0, "the 1st is not selectable" );
+
+ input.datepicker( "option", "eachDay", function( day ) {
+ if ( day.date === 1 ) {
+ day.extraClasses = "ui-custom";
+ }
+ });
+ ok( picker.find( "td[id]:first a" ).hasClass( "ui-custom" ), "extraClasses applied" );
+
+ input.datepicker( "destroy" );
});
test( "numberOfMonths", function() {