Skip to content

Commit 37b3442

Browse files
committed
add test
1 parent d25e273 commit 37b3442

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/lib/datepicker/datepicker.spec.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,21 @@ describe('MdDatepicker', () => {
411411

412412
expect(inputEl.classList).toContain('ng-touched');
413413
});
414+
415+
it('should mark input touched on calendar selection', () => {
416+
let inputEl = fixture.debugElement.query(By.css('input')).nativeElement;
417+
418+
expect(inputEl.classList).toContain('ng-untouched');
419+
420+
testComponent.datepicker._selectAndClose(new Date(2017, JAN, 1));
421+
fixture.detectChanges();
422+
423+
fixture.whenStable().then(() => {
424+
fixture.detectChanges();
425+
426+
expect(inputEl.classList).toContain('ng-touched');
427+
});
428+
});
414429
});
415430

416431
describe('datepicker with formControl', () => {

0 commit comments

Comments
 (0)