@@ -106,7 +106,7 @@ describe('CalendarDayViewComponent component', () => {
106
106
fixture . destroy ( ) ;
107
107
} ) ;
108
108
109
- it ( 'should call the event clicked callback' , async ( ( ) => {
109
+ it ( 'should call the event clicked callback' , ( ) => {
110
110
const fixture : ComponentFixture <
111
111
CalendarDayViewComponent
112
112
> = TestBed . createComponent ( CalendarDayViewComponent ) ;
@@ -123,16 +123,15 @@ describe('CalendarDayViewComponent component', () => {
123
123
] ;
124
124
125
125
fixture . detectChanges ( ) ;
126
- fixture . componentInstance . eventClicked . subscribe ( val => {
127
- expect ( val ) . to . deep . equal ( {
128
- event : fixture . componentInstance . events [ 0 ] ,
129
- sourceEvent : window [ 'event' ]
130
- } ) ;
131
- } ) ;
126
+ const spy = sinon . spy ( ) ;
127
+ fixture . componentInstance . eventClicked . subscribe ( spy ) ;
132
128
fixture . nativeElement . querySelector ( '.cal-event-title' ) . click ( ) ;
133
- } ) ) ;
129
+ const call = spy . getCall ( 0 ) . args [ 0 ] ;
130
+ expect ( call . event ) . to . equal ( fixture . componentInstance . events [ 0 ] ) ;
131
+ expect ( call . sourceEvent ) . to . be . an . instanceOf ( MouseEvent ) ;
132
+ } ) ;
134
133
135
- it ( 'should call the event clicked callback on all day events' , async ( ( ) => {
134
+ it ( 'should call the event clicked callback on all day events' , ( ) => {
136
135
const fixture : ComponentFixture <
137
136
CalendarDayViewComponent
138
137
> = TestBed . createComponent ( CalendarDayViewComponent ) ;
@@ -150,14 +149,13 @@ describe('CalendarDayViewComponent component', () => {
150
149
] ;
151
150
152
151
fixture . detectChanges ( ) ;
153
- fixture . componentInstance . eventClicked . subscribe ( val => {
154
- expect ( val ) . to . deep . equal ( {
155
- event : fixture . componentInstance . events [ 0 ] ,
156
- sourceEvent : window [ 'event' ]
157
- } ) ;
158
- } ) ;
152
+ const spy = sinon . spy ( ) ;
153
+ fixture . componentInstance . eventClicked . subscribe ( spy ) ;
159
154
fixture . nativeElement . querySelector ( '.cal-event-title' ) . click ( ) ;
160
- } ) ) ;
155
+ const call = spy . getCall ( 0 ) . args [ 0 ] ;
156
+ expect ( call . event ) . to . equal ( fixture . componentInstance . events [ 0 ] ) ;
157
+ expect ( call . sourceEvent ) . to . be . an . instanceOf ( MouseEvent ) ;
158
+ } ) ;
161
159
162
160
it ( 'should add a custom CSS class to events' , ( ) => {
163
161
const fixture : ComponentFixture <
@@ -743,6 +741,7 @@ describe('CalendarDayViewComponent component', () => {
743
741
triggerDomEvent ( 'mouseleave' , event ) ;
744
742
fixture . detectChanges ( ) ;
745
743
expect ( ! ! document . body . querySelector ( '.cal-tooltip' ) ) . to . equal ( false ) ;
744
+ fixture . destroy ( ) ;
746
745
} ) ) ;
747
746
748
747
it ( 'should disable the tooltip' , fakeAsync ( ( ) => {
@@ -771,6 +770,7 @@ describe('CalendarDayViewComponent component', () => {
771
770
fixture . detectChanges ( ) ;
772
771
flush ( ) ;
773
772
expect ( ! ! document . body . querySelector ( '.cal-tooltip' ) ) . to . equal ( false ) ;
773
+ fixture . destroy ( ) ;
774
774
} ) ) ;
775
775
776
776
it ( 'should allow events to be dragged and dropped' , ( ) => {
0 commit comments