Skip to content

Commit 6b7bbf0

Browse files
test(igxTimePicker): should properly switch am/pm when typing
1 parent 987d27d commit 6b7bbf0

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

projects/igniteui-angular/src/lib/time-picker/time-picker.component.spec.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1766,7 +1766,10 @@ describe('IgxTimePicker', () => {
17661766

17671767
describe('Hour/minute only mode', () => {
17681768
configureTestSuite();
1769-
let fixture, timePicker, dom, input;
1769+
let fixture: ComponentFixture<IgxTimePickerDropDownSingleHourComponent>,
1770+
timePicker: IgxTimePickerComponent,
1771+
dom: DebugElement,
1772+
input: DebugElement;
17701773

17711774
beforeEach(
17721775
async(() => {
@@ -1841,6 +1844,21 @@ describe('IgxTimePicker', () => {
18411844
expect(_input.nativeElement.value).toEqual('12 AM');
18421845
}));
18431846

1847+
it('Should properly switch between AM/PM when typing', () => {
1848+
fixture.componentInstance.format = 'hh tt';
1849+
fixture.componentInstance.customDate = new Date(2018, 10, 27, 17, 45, 0, 0);
1850+
fixture.detectChanges();
1851+
1852+
input.triggerEventHandler('focus', { target: input.nativeElement });
1853+
UIInteractions.simulateTyping('pm', input, 2, 4);
1854+
fixture.detectChanges();
1855+
expect(input.nativeElement.value).toEqual('05 pm');
1856+
1857+
input.triggerEventHandler('blur', { target: input.nativeElement });
1858+
fixture.detectChanges();
1859+
expect(input.nativeElement.value).toEqual('05 PM');
1860+
});
1861+
18441862
it('Should navigate dropdown lists correctly when format contains only hours.', fakeAsync(() => {
18451863
fixture.componentInstance.format = 'hh tt';
18461864
fixture.componentInstance.customDate = new Date(2018, 10, 27, 17, 45, 0);

0 commit comments

Comments
 (0)