@@ -185,8 +185,8 @@ describe('ExpandableCalendar', () => {
185
185
jest . runAllTimers ( ) ;
186
186
const expectedDate = today . clone ( ) . setDate ( 1 ) . addMonths ( direction === Direction . RIGHT ? 1 : - 1 ) ;
187
187
driver . pressOnHeaderArrow ( { left : direction === Direction . LEFT } ) ;
188
- expect ( onDateChanged ) . toHaveBeenCalledWith ( toMarkingFormat ( expectedDate ) , UpdateSources . ARROW_PRESS ) ;
189
- expect ( onMonthChange ) . toHaveBeenCalledWith ( xdateToData ( expectedDate ) , UpdateSources . ARROW_PRESS ) ;
188
+ expect ( onDateChanged ) . toHaveBeenCalledWith ( toMarkingFormat ( expectedDate ) , UpdateSources . PAGE_SCROLL ) ;
189
+ expect ( onMonthChange ) . toHaveBeenCalledWith ( xdateToData ( expectedDate ) , UpdateSources . PAGE_SCROLL ) ;
190
190
} ) ;
191
191
192
192
it ( `should call onDateChanged and onMonthChanged for first day in initial month when changing to initial month` , ( ) => {
@@ -197,8 +197,8 @@ describe('ExpandableCalendar', () => {
197
197
driver . pressOnHeaderArrow ( { left : true } ) ;
198
198
jest . runAllTimers ( ) ;
199
199
const expectedDate = today . clone ( ) . setDate ( 1 ) ;
200
- expect ( onDateChanged ) . toHaveBeenNthCalledWith ( 2 , toMarkingFormat ( expectedDate ) , UpdateSources . ARROW_PRESS ) ;
201
- expect ( onMonthChange ) . toHaveBeenNthCalledWith ( 2 , xdateToData ( expectedDate ) , UpdateSources . ARROW_PRESS ) ;
200
+ expect ( onDateChanged ) . toHaveBeenNthCalledWith ( 2 , toMarkingFormat ( expectedDate ) , UpdateSources . PAGE_SCROLL ) ;
201
+ expect ( onMonthChange ) . toHaveBeenNthCalledWith ( 2 , xdateToData ( expectedDate ) , UpdateSources . PAGE_SCROLL ) ;
202
202
} ) ;
203
203
204
204
it ( `should navigate 6 months ahead and back successfully` , ( ) => {
@@ -209,13 +209,13 @@ describe('ExpandableCalendar', () => {
209
209
} ) ;
210
210
jest . runAllTimers ( ) ;
211
211
const expectedFutureDate = today . clone ( ) . setDate ( 1 ) . addMonths ( 6 ) ;
212
- expect ( onDateChanged ) . toHaveBeenNthCalledWith ( 6 , toMarkingFormat ( expectedFutureDate ) , UpdateSources . ARROW_PRESS ) ;
213
- expect ( onMonthChange ) . toHaveBeenNthCalledWith ( 6 , xdateToData ( expectedFutureDate ) , UpdateSources . ARROW_PRESS ) ;
212
+ expect ( onDateChanged ) . toHaveBeenNthCalledWith ( 6 , toMarkingFormat ( expectedFutureDate ) , UpdateSources . PAGE_SCROLL ) ;
213
+ expect ( onMonthChange ) . toHaveBeenNthCalledWith ( 6 , xdateToData ( expectedFutureDate ) , UpdateSources . PAGE_SCROLL ) ;
214
214
times ( 6 , ( ) => driver . pressOnHeaderArrow ( { left : true } ) ) ;
215
215
jest . runAllTimers ( ) ;
216
216
const expectedDate = today . clone ( ) . setDate ( 1 ) ;
217
- expect ( onDateChanged ) . toHaveBeenNthCalledWith ( 12 , toMarkingFormat ( expectedDate ) , UpdateSources . ARROW_PRESS ) ;
218
- expect ( onMonthChange ) . toHaveBeenNthCalledWith ( 12 , xdateToData ( expectedDate ) , UpdateSources . ARROW_PRESS ) ;
217
+ expect ( onDateChanged ) . toHaveBeenNthCalledWith ( 12 , toMarkingFormat ( expectedDate ) , UpdateSources . PAGE_SCROLL ) ;
218
+ expect ( onMonthChange ) . toHaveBeenNthCalledWith ( 12 , xdateToData ( expectedDate ) , UpdateSources . PAGE_SCROLL ) ;
219
219
} ) ;
220
220
} ) ;
221
221
} ) ;
@@ -247,14 +247,14 @@ describe('ExpandableCalendar', () => {
247
247
const currentDay = today . getDay ( ) ;
248
248
const expectedDate = today . clone ( ) . addDays ( direction === Direction . LEFT ? - ( currentDay + 7 ) : ( 7 - currentDay ) ) ;
249
249
driver . pressOnHeaderArrow ( { left : direction === Direction . LEFT } ) ;
250
- expect ( onDateChanged ) . toHaveBeenCalledWith ( toMarkingFormat ( expectedDate ) , UpdateSources . WEEK_ARROW_PRESS ) ;
250
+ expect ( onDateChanged ) . toHaveBeenCalledWith ( toMarkingFormat ( expectedDate ) , UpdateSources . PAGE_SCROLL ) ;
251
251
} ) ;
252
252
253
253
it ( `should call onDateChanged for first day of initial week when changing to initial week` , ( ) => {
254
254
driver . pressOnHeaderArrow ( { left : false } ) ;
255
255
driver . pressOnHeaderArrow ( { left : true } ) ;
256
256
const expectedDate = today . clone ( ) . addDays ( - ( today . getDay ( ) ) ) ;
257
- expect ( onDateChanged ) . toHaveBeenNthCalledWith ( 2 , toMarkingFormat ( expectedDate ) , UpdateSources . WEEK_ARROW_PRESS ) ;
257
+ expect ( onDateChanged ) . toHaveBeenNthCalledWith ( 2 , toMarkingFormat ( expectedDate ) , UpdateSources . PAGE_SCROLL ) ;
258
258
} ) ;
259
259
260
260
it ( 'should fetch next weeks when in last week of the list' , ( ) => {
@@ -270,7 +270,7 @@ describe('ExpandableCalendar', () => {
270
270
const diff = Math . ceil ( ( ( endOfMonth . getUTCDate ( ) + 1 ) - today . getUTCDate ( ) ) / 7 ) + ( ( today . getUTCDay ( ) > endOfMonth . getUTCDay ( ) ) ? 1 : 0 ) ;
271
271
const expectedDate = today . clone ( ) . setDate ( today . getDate ( ) + 7 * diff - today . getDay ( ) ) ;
272
272
times ( diff , ( ) => driver . pressOnHeaderArrow ( { left : false } ) ) ;
273
- expect ( onMonthChange ) . toHaveBeenCalledWith ( xdateToData ( expectedDate ) , UpdateSources . WEEK_ARROW_PRESS ) ;
273
+ expect ( onMonthChange ) . toHaveBeenCalledWith ( xdateToData ( expectedDate ) , UpdateSources . PAGE_SCROLL ) ;
274
274
} ) ;
275
275
} ) ;
276
276
} ) ;
0 commit comments