Date tests: Fix months method tests

Make sure tests are not depending on current month. Fixes tests run in December.
Removed duplicate test. Improve test descriptions.
This commit is contained in:
Felix Nagel 2016-01-20 12:12:53 +01:00
parent e17e7b0d87
commit 6baa74ba45

View File

@ -145,16 +145,16 @@ test( "Days", 1, function() {
} ); } );
test( "Months", 5, function() { test( "Months", 5, function() {
var date = $.ui.date( null, attributes ), var date = $.ui.date( new Date( 2015, 11 - 1, 15 ), attributes ),
firstMonth = date.months( 1 )[ 0 ], currentMonth = date.months( 1 )[ 0 ],
lastMonth = date.months( 1 )[ 1 ]; nextMonth = date.months( 1 )[ 1 ];
ok( firstMonth.first ); ok( currentMonth.first, "Current month marked as first" );
ok( !lastMonth.first ); ok( !nextMonth.first, "Next month not marked as first" );
ok( lastMonth.last ); ok( nextMonth.last, "Next month marked as last" );
ok( !lastMonth.first );
equal( firstMonth.month(), lastMonth.month() - 1 ); equal( currentMonth.month(), 10, "Current month index is November" );
equal( nextMonth.month(), 11, "Next month index is December" );
} ); } );
test( "Equal", 4, function() { test( "Equal", 4, function() {