@@ -244,7 +244,7 @@ describe('DetailsFieldsComponent', () => {
244
244
} ,
245
245
shouldRestartEntry : false
246
246
} ;
247
- expect ( component . shouldRestartEntry ) . toBeFalse ( ) ;
247
+
248
248
expect ( component . saveEntry . emit ) . toHaveBeenCalledWith ( data ) ;
249
249
} ) ;
250
250
@@ -300,6 +300,23 @@ describe('DetailsFieldsComponent', () => {
300
300
fixture . componentInstance . ngOnChanges ( ) ;
301
301
302
302
expect ( component . goingToWorkOnThis ) . toBeFalse ( ) ;
303
+ expect ( component . shouldRestartEntry ) . toBeFalse ( ) ;
304
+ } ) ;
305
+
306
+ it ( 'when editing entry is running, shouldRestartEntry should be false' , ( ) => {
307
+ component . entryToEdit = { ...entryToEdit , running : true } ;
308
+
309
+ fixture . componentInstance . ngOnChanges ( ) ;
310
+
311
+ expect ( component . goingToWorkOnThis ) . toBeTrue ( ) ;
312
+ expect ( component . shouldRestartEntry ) . toBeFalse ( ) ;
313
+ } ) ;
314
+
315
+ it ( 'when editing entry change to going to work on this shouldRestartEntry should be true' , ( ) => {
316
+ component . onGoingToWorkOnThisChange ( { currentTarget : { checked : true } } ) ;
317
+
318
+ expect ( component . goingToWorkOnThis ) . toBeTrue ( ) ;
319
+ expect ( component . shouldRestartEntry ) . toBeTrue ( ) ;
303
320
} ) ;
304
321
305
322
it ( 'when submitting a entry that is currently running, the end date should not be sent ' , ( ) => {
@@ -322,7 +339,7 @@ describe('DetailsFieldsComponent', () => {
322
339
} ,
323
340
shouldRestartEntry : false
324
341
} ;
325
- expect ( component . shouldRestartEntry ) . toBeFalse ( ) ;
342
+
326
343
expect ( component . saveEntry . emit ) . toHaveBeenCalledWith ( data ) ;
327
344
} ) ;
328
345
0 commit comments