@@ -77,7 +77,7 @@ describe('calendarMonthView component', () => {
77
77
fixture . destroy ( ) ;
78
78
} ) ;
79
79
80
- it ( 'should emit on the columnHeaderClicked output' , ( done ) => {
80
+ it ( 'should emit on the columnHeaderClicked output' , done => {
81
81
const fixture : ComponentFixture <
82
82
CalendarMonthViewComponent
83
83
> = TestBed . createComponent ( CalendarMonthViewComponent ) ;
@@ -187,6 +187,41 @@ describe('calendarMonthView component', () => {
187
187
fixture . destroy ( ) ;
188
188
} ) ;
189
189
190
+ it ( 'should use the activeDay input instead of the viewDate to determine the active day' , ( ) => {
191
+ const fixture : ComponentFixture <
192
+ CalendarMonthViewComponent
193
+ > = TestBed . createComponent ( CalendarMonthViewComponent ) ;
194
+ expect ( fixture . componentInstance . openRowIndex ) . to . equal ( undefined ) ;
195
+ expect ( fixture . componentInstance . openDay ) . to . equal ( undefined ) ;
196
+ fixture . componentInstance . viewDate = moment ( )
197
+ . startOf ( 'month' )
198
+ . startOf ( 'week' )
199
+ . add ( 14 , 'days' )
200
+ . toDate ( ) ;
201
+ fixture . componentInstance . activeDay = moment ( )
202
+ . startOf ( 'month' )
203
+ . startOf ( 'week' )
204
+ . add ( 8 , 'days' )
205
+ . toDate ( ) ;
206
+ fixture . componentInstance . activeDayIsOpen = true ;
207
+ fixture . componentInstance . ngOnChanges ( {
208
+ viewDate : { } ,
209
+ activeDayIsOpen : { }
210
+ } ) ;
211
+ expect ( fixture . componentInstance . openRowIndex ) . to . equal ( 7 ) ;
212
+ expect ( fixture . componentInstance . openDay ) . to . equal (
213
+ fixture . componentInstance . view . days [ 8 ]
214
+ ) ;
215
+ fixture . componentInstance . activeDayIsOpen = false ;
216
+ fixture . componentInstance . ngOnChanges ( {
217
+ viewDate : { } ,
218
+ activeDayIsOpen : { }
219
+ } ) ;
220
+ expect ( ! ! fixture . componentInstance . openRowIndex ) . to . equal ( false ) ;
221
+ expect ( ! ! fixture . componentInstance . openDay ) . to . equal ( false ) ;
222
+ fixture . destroy ( ) ;
223
+ } ) ;
224
+
190
225
it ( 'should add a custom CSS class to events' , ( ) => {
191
226
const fixture : ComponentFixture <
192
227
CalendarMonthViewComponent
0 commit comments