File tree Expand file tree Collapse file tree 2 files changed +38
-2
lines changed Expand file tree Collapse file tree 2 files changed +38
-2
lines changed Original file line number Diff line number Diff line change @@ -71,12 +71,12 @@ export default function Navigation({
7171    return  minDate  &&  minDate  >=  previousActiveEndDate ; 
7272  } ) ( ) ; 
7373
74-   const  nextButtonDisabled  =  maxDate  &&  maxDate  <=   nextActiveStartDate ; 
74+   const  nextButtonDisabled  =  maxDate  &&  maxDate  <  nextActiveStartDate ; 
7575
7676  const  next2ButtonDisabled  =  ( 
7777    shouldShowPrevNext2Buttons 
7878    &&  maxDate 
79-     &&  maxDate  <=   nextActiveStartDate2 
79+     &&  maxDate  <  nextActiveStartDate2 
8080  ) ; 
8181
8282  function  onClickPrevious ( )  { 
Original file line number Diff line number Diff line change @@ -445,6 +445,42 @@ describe('Navigation', () => {
445445    expect ( next2 . prop ( 'disabled' ) ) . toBeTruthy ( ) ; 
446446  } ) ; 
447447
448+   it ( 'does not disallow navigating to next month when maxDate is set to first day of the next month' ,  ( )  =>  { 
449+     const  component  =  shallow ( 
450+       < Navigation 
451+         { ...defaultProps } 
452+         maxDate = { new  Date ( 2017 ,  1 ,  1 ) } 
453+         view = "month" 
454+       /> , 
455+     ) ; 
456+ 
457+     const  arrows  =  component . find ( 'button.react-calendar__navigation__arrow' ) ; 
458+ 
459+     const  next  =  arrows . at ( 2 ) ; 
460+     const  next2  =  arrows . at ( 3 ) ; 
461+ 
462+     expect ( next . prop ( 'disabled' ) ) . toBeFalsy ( ) ; 
463+     expect ( next2 . prop ( 'disabled' ) ) . toBeTruthy ( ) ; 
464+   } ) ; 
465+ 
466+   it ( 'does not disallow navigating to next year when maxDate is set to first day of the next year' ,  ( )  =>  { 
467+     const  component  =  shallow ( 
468+       < Navigation 
469+         { ...defaultProps } 
470+         maxDate = { new  Date ( 2018 ,  0 ,  1 ) } 
471+         view = "month" 
472+       /> , 
473+     ) ; 
474+ 
475+     const  arrows  =  component . find ( 'button.react-calendar__navigation__arrow' ) ; 
476+ 
477+     const  next  =  arrows . at ( 2 ) ; 
478+     const  next2  =  arrows . at ( 3 ) ; 
479+ 
480+     expect ( next . prop ( 'disabled' ) ) . toBeFalsy ( ) ; 
481+     expect ( next2 . prop ( 'disabled' ) ) . toBeFalsy ( ) ; 
482+   } ) ; 
483+ 
448484  it ( 'disallows navigating after dynamically set maxDate' ,  ( )  =>  { 
449485    const  component  =  shallow ( 
450486      < Navigation 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments