diff --git a/projects/igniteui-angular/src/lib/time-picker/time-picker.component.spec.ts b/projects/igniteui-angular/src/lib/time-picker/time-picker.component.spec.ts
index 627769b42a5..904239473b9 100644
--- a/projects/igniteui-angular/src/lib/time-picker/time-picker.component.spec.ts
+++ b/projects/igniteui-angular/src/lib/time-picker/time-picker.component.spec.ts
@@ -183,10 +183,32 @@ describe('IgxTimePicker', () => {
expect(timePicker.onValidationFailed.emit).toHaveBeenCalled();
}));
- it('TimePicker cancel button', fakeAsync(() => {
+ it('Should display mask on cancel button click with bound null value', fakeAsync(() => {
const fixture = TestBed.createComponent(IgxTimePickerWithPmTimeComponent);
+ fixture.componentInstance.dateValue = null;
+ fixture.componentInstance.mode = 'dropdown';
+ fixture.detectChanges();
+ const timePicker = fixture.componentInstance.timePicker;
+ const dom = fixture.debugElement;
+ const timePickerTarget = dom.query(By.directive(IgxInputDirective));
+ spyOn(timePicker.onValidationFailed, 'emit');
+
+ UIInteractions.clickElement(timePickerTarget);
+ tick();
fixture.detectChanges();
+ const cancelButton = dom.query(By.css('.igx-button--flat'));
+ UIInteractions.clickElement(cancelButton);
+ tick();
+ fixture.detectChanges();
+
+ expect(timePicker.onValidationFailed.emit).not.toHaveBeenCalled();
+ expect(timePicker.displayValue).toEqual('--:--:-- --');
+ }));
+
+ it('TimePicker cancel button', fakeAsync(() => {
+ const fixture = TestBed.createComponent(IgxTimePickerWithPmTimeComponent);
+ fixture.detectChanges();
const timePicker = fixture.componentInstance.timePicker;
const dom = fixture.debugElement;
const initialTime = dom.query(By.directive(IgxInputDirective)).nativeElement.value;
@@ -2024,12 +2046,13 @@ export class IgxTimePickerWithPassedTimeComponent {
@Component({
template: `
-