@@ -13,7 +13,8 @@ import {
13
13
CalendarMomentDateFormatter ,
14
14
CalendarDateFormatter ,
15
15
CalendarModule ,
16
- MOMENT
16
+ MOMENT ,
17
+ CalendarMonthViewDay
17
18
} from './../src' ;
18
19
import { CalendarMonthViewComponent } from './../src/components/month/calendarMonthView.component' ;
19
20
import { Subject } from 'rxjs/Subject' ;
@@ -127,6 +128,28 @@ describe('calendarMonthView component', () => {
127
128
fixture . destroy ( ) ;
128
129
} ) ;
129
130
131
+ it ( 'should not remove other classes when removing the cssClass' , ( ) => {
132
+ const fixture : ComponentFixture < CalendarMonthViewComponent > = TestBed . createComponent ( CalendarMonthViewComponent ) ;
133
+ fixture . componentInstance . viewDate = new Date ( '2016-06-27' ) ;
134
+ let firstDay : CalendarMonthViewDay ;
135
+ fixture . componentInstance . dayModifier = ( day ) => {
136
+ if ( ! firstDay ) {
137
+ firstDay = day ;
138
+ day . cssClass = 'foo' ;
139
+ }
140
+ } ;
141
+ fixture . componentInstance . ngOnChanges ( { viewDate : { } , events : { } } ) ;
142
+ fixture . detectChanges ( ) ;
143
+ const cell : HTMLElement = fixture . nativeElement . querySelector ( '.cal-days .cal-cell' ) ;
144
+ expect ( cell . classList . contains ( 'foo' ) ) . to . equal ( true ) ;
145
+ expect ( cell . classList . contains ( 'cal-out-month' ) ) . to . equal ( true ) ;
146
+ delete firstDay . cssClass ;
147
+ fixture . detectChanges ( ) ;
148
+ expect ( cell . classList . contains ( 'foo' ) ) . to . equal ( false ) ;
149
+ expect ( cell . classList . contains ( 'cal-out-month' ) ) . to . equal ( true ) ;
150
+ fixture . destroy ( ) ;
151
+ } ) ;
152
+
130
153
it ( 'should add the highlight class to events on mouse over' , ( ) => {
131
154
const fixture : ComponentFixture < CalendarMonthViewComponent > = TestBed . createComponent ( CalendarMonthViewComponent ) ;
132
155
fixture . componentInstance . viewDate = new Date ( '2016-06-27' ) ;
0 commit comments