]> source.dussan.org Git - jquery-ui.git/commitdiff
Calendar tests: Add basic value option tests
authorFelix Nagel <info@felixnagel.com>
Sun, 22 May 2016 20:23:01 +0000 (22:23 +0200)
committerFelix Nagel <info@felixnagel.com>
Tue, 11 Oct 2016 23:04:25 +0000 (01:04 +0200)
tests/unit/calendar/options.js

index 2815987946b72241a9c9093b656d408bad68f93b..9fb49b362a4ea8325dffaf8a0fbbe90e22cf3f9e 100644 (file)
@@ -310,6 +310,21 @@ test( "numberOfMonths", function() {
        );
 } );
 
+test( "value", function( assert ) {
+       expect( 4 );
+
+       var date = new Date( 2016, 5 - 1, 23 );
+
+       assert.equal( this.element.calendar( "option", "value" ), null, "Initial value" );
+
+       this.element.calendar( "option", "value", date );
+       assert.dateEqual( this.element.calendar( "option", "value" ), date, "Value set" );
+       equal( this.widget.find( "table button.ui-state-active" ).data( "timestamp" ), 1463954400000, "Active button timestamp" );
+
+       this.element.calendar( "option", "value", "invalid" );
+       assert.dateEqual( this.element.calendar( "option", "value" ), date, "Value after invalid parameter" );
+} );
+
 /*
 // TODO: Move this to $.date, Globalize or calendar widget
 test( "daylightSaving", function() {