Skip to content

Commit

Permalink
#918 - enhance go-date-picker
Browse files Browse the repository at this point in the history
  • Loading branch information
sinchananj12 committed Jul 18, 2023
1 parent 356fdf5 commit 80ec883
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
[(ngModel)]="selectedDate"
(blur)="validateDate()"
[disabled]="control.disabled"
(input)="closeCalendar()"
(input)="onInputCloseCalendar()"
(click)="toggleDatepicker($event)"
/>
<go-icon-button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,4 +235,15 @@ describe('GoDatepickerComponent', () => {
expect(component.goCalendar.isOpen).toBe(false);
});
});

describe("onInputCloseCalendar", () => {
it('close the calendar when the user interacts with the date field by typing inside it. ', () => {
component.goCalendar.openCalendar(new Date());

component.onInputCloseCalendar();

expect(component.goCalendar.isOpen).toBe(false);
});
});

});
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ export class GoDatepickerComponent extends GoFormBaseComponent implements OnDest
private initializePlaceholder(): void {
this.placeholder = this.placeholder || LocaleFormat.format(this.locale);
}
closeCalendar() {

public onInputCloseCalendar(): void {
if (this.goCalendar.isOpen) {
this.goCalendar.closeCalendar();
}
Expand Down

0 comments on commit 80ec883

Please sign in to comment.