@@ -399,7 +399,7 @@ test('if updates pikaday config if options hash is changed', function(assert) {
399
399
assert . notOk ( $ ( `td[data-day=${ weekendDay } ]` ) . hasClass ( 'is-disabled' ) ) ;
400
400
} ) ;
401
401
402
- test ( 'if minDate is greater than value we we set pikaday\'s current date to minDate' , function ( assert ) {
402
+ test ( 'if minDate is greater than value we set pikaday\'s current date to minDate' , function ( assert ) {
403
403
assert . expect ( 1 ) ;
404
404
405
405
let today = new Date ( ) ;
@@ -440,3 +440,20 @@ test('if value is null we don\'t enforce minDate or maxDate', function(assert) {
440
440
run ( ( ) => this . set ( 'minDate' , today ) ) ;
441
441
assert . equal ( this . get ( 'currentDate' ) , null , 'value should be null' ) ;
442
442
} ) ;
443
+
444
+ test ( 'the original date passed to minDate or maxDate is not modified by pikaday' , function ( assert ) {
445
+ assert . expect ( 2 ) ;
446
+
447
+ let today = new Date ( ) ;
448
+ let todayCopy = new Date ( today ) ;
449
+ let tomorrow = new Date ( Date . now ( ) + ( 60 * 60 * 24 * 1000 ) ) ;
450
+ let tomorrowCopy = new Date ( tomorrow ) ;
451
+
452
+ this . render ( hbs `{{pikaday-input minDate=minDate maxDate=maxDate value=today}}` ) ;
453
+
454
+ run ( ( ) => this . set ( 'minDate' , today ) ) ;
455
+ run ( ( ) => this . set ( 'maxDate' , tomorrow ) ) ;
456
+
457
+ assert . equal ( today . toISOString ( ) , todayCopy . toISOString ( ) , 'value should not change' ) ;
458
+ assert . equal ( tomorrow . toISOString ( ) , tomorrowCopy . toISOString ( ) , 'value should not change' ) ;
459
+ } ) ;
0 commit comments