@@ -339,6 +339,20 @@ describe('<lion-calendar>', () => {
339339 clock . restore ( ) ;
340340 } ) ;
341341
342+ it ( 'should set centralDate to the unique valid value when minDate and maxDate are equal' , async ( ) => {
343+ const clock = sinon . useFakeTimers ( { now : new Date ( '2019/06/03' ) . getTime ( ) } ) ;
344+
345+ const el = await fixture ( html `
346+ < lion-calendar
347+ .minDate ="${ new Date ( '2019/07/03' ) } "
348+ .maxDate ="${ new Date ( '2019/07/03' ) } "
349+ > </ lion-calendar >
350+ ` ) ;
351+ expect ( isSameDate ( el . centralDate , new Date ( '2019/07/03' ) ) , 'central date' ) . to . be . true ;
352+
353+ clock . restore ( ) ;
354+ } ) ;
355+
342356 describe ( 'Normalization' , ( ) => {
343357 it ( 'normalizes all generated dates' , async ( ) => {
344358 function isNormalizedDate ( d ) {
@@ -504,7 +518,7 @@ describe('<lion-calendar>', () => {
504518 elObj . previousMonthButtonEl . click ( ) ;
505519 await el . updateComplete ;
506520 expect ( elObj . activeMonthAndYear ) . to . equal ( 'November 2000' ) ;
507- expect ( isSameDate ( el . centralDate , new Date ( '2000/11/21 ' ) ) ) . to . be . true ;
521+ expect ( isSameDate ( el . centralDate , new Date ( '2000/11/20 ' ) ) ) . to . be . true ;
508522
509523 clock . restore ( ) ;
510524 } ) ;
@@ -527,7 +541,7 @@ describe('<lion-calendar>', () => {
527541 elObj . nextMonthButtonEl . click ( ) ;
528542 await el . updateComplete ;
529543 expect ( elObj . activeMonthAndYear ) . to . equal ( 'January 2001' ) ;
530- expect ( isSameDate ( el . centralDate , new Date ( '2001/01/09 ' ) ) ) . to . be . true ;
544+ expect ( isSameDate ( el . centralDate , new Date ( '2001/01/10 ' ) ) ) . to . be . true ;
531545
532546 clock . restore ( ) ;
533547 } ) ;
0 commit comments