@@ -950,19 +950,19 @@ describe('DatePicker', function () {
950
950
fireEvent . keyDown ( document . activeElement , { key : 'ArrowRight' } ) ;
951
951
expect ( segments [ 1 ] ) . toHaveFocus ( ) ;
952
952
expect ( onChange ) . not . toHaveBeenCalled ( ) ;
953
- let value = today ( getLocalTimeZone ( ) ) . add ( { months : 1 } ) ;
953
+ let value = today ( getLocalTimeZone ( ) ) . cycle ( 'month' , 1 ) ;
954
954
expect ( combobox ) . toHaveTextContent ( formatter . format ( value . toDate ( getLocalTimeZone ( ) ) ) ) ;
955
955
956
956
fireEvent . keyDown ( document . activeElement , { key : 'ArrowUp' } ) ;
957
957
fireEvent . keyDown ( document . activeElement , { key : 'ArrowRight' } ) ;
958
958
expect ( segments [ 2 ] ) . toHaveFocus ( ) ;
959
959
expect ( onChange ) . not . toHaveBeenCalled ( ) ;
960
- value = today ( getLocalTimeZone ( ) ) . add ( { months : 1 , days : 1 } ) ;
960
+ value = value . cycle ( 'day' , 1 ) ;
961
961
expect ( combobox ) . toHaveTextContent ( formatter . format ( value . toDate ( getLocalTimeZone ( ) ) ) ) ;
962
962
963
963
fireEvent . keyDown ( document . activeElement , { key : 'ArrowUp' } ) ;
964
964
expect ( onChange ) . toHaveBeenCalledTimes ( 1 ) ;
965
- value = today ( getLocalTimeZone ( ) ) . add ( { years : 1 , months : 1 , days : 1 } ) ;
965
+ value = value . cycle ( 'year' , 1 ) ;
966
966
expect ( onChange ) . toHaveBeenCalledWith ( value ) ;
967
967
expect ( combobox ) . toHaveTextContent ( formatter . format ( value . toDate ( getLocalTimeZone ( ) ) ) ) ;
968
968
} ) ;
@@ -982,22 +982,22 @@ describe('DatePicker', function () {
982
982
fireEvent . keyDown ( document . activeElement , { key : 'ArrowRight' } ) ;
983
983
expect ( segments [ 1 ] ) . toHaveFocus ( ) ;
984
984
expect ( onChange ) . not . toHaveBeenCalled ( ) ;
985
- let value = today ( getLocalTimeZone ( ) ) . add ( { months : 1 } ) ;
985
+ let value = today ( getLocalTimeZone ( ) ) . cycle ( 'month' , 1 ) ;
986
986
expect ( combobox ) . toHaveTextContent ( formatter . format ( value . toDate ( getLocalTimeZone ( ) ) ) ) ;
987
987
988
988
fireEvent . keyDown ( document . activeElement , { key : 'ArrowUp' } ) ;
989
989
fireEvent . keyDown ( document . activeElement , { key : 'ArrowRight' } ) ;
990
990
expect ( segments [ 2 ] ) . toHaveFocus ( ) ;
991
991
expect ( onChange ) . not . toHaveBeenCalled ( ) ;
992
- value = today ( getLocalTimeZone ( ) ) . add ( { months : 1 , days : 1 } ) ;
992
+ value = value . cycle ( 'day' , 1 ) ;
993
993
expect ( combobox ) . toHaveTextContent ( formatter . format ( value . toDate ( getLocalTimeZone ( ) ) ) ) ;
994
994
995
995
fireEvent . keyDown ( document . activeElement , { key : 'ArrowUp' } ) ;
996
996
expect ( onChange ) . toHaveBeenCalledTimes ( 1 ) ;
997
- expect ( onChange ) . toHaveBeenCalledWith ( today ( getLocalTimeZone ( ) ) . add ( { years : 1 , months : 1 , days : 1 } ) ) ;
997
+ expect ( onChange ) . toHaveBeenCalledWith ( value . cycle ( 'year' , 1 ) ) ;
998
998
expect ( combobox ) . toHaveTextContent ( formatter . format ( value . toDate ( getLocalTimeZone ( ) ) ) ) ; // controlled
999
999
1000
- value = today ( getLocalTimeZone ( ) ) . add ( { years : 1 , months : 1 , days : 1 } ) ;
1000
+ value = value . cycle ( 'year' , 1 ) ;
1001
1001
rerender ( < DatePicker label = "Date" onChange = { onChange } value = { value } /> ) ;
1002
1002
expect ( combobox ) . toHaveTextContent ( formatter . format ( value . toDate ( getLocalTimeZone ( ) ) ) ) ;
1003
1003
} ) ;
0 commit comments