|
1 | | -import { Component, ViewChild, NgModule, ElementRef, EventEmitter } from '@angular/core'; |
| 1 | +import { Component, ViewChild, NgModule, ElementRef, EventEmitter, DebugElement } from '@angular/core'; |
2 | 2 | import { async, TestBed, fakeAsync, tick, ComponentFixture } from '@angular/core/testing'; |
3 | 3 | import { FormsModule, FormGroup, FormBuilder, ReactiveFormsModule, Validators } from '@angular/forms'; |
4 | 4 | import { By } from '@angular/platform-browser'; |
@@ -1766,7 +1766,10 @@ describe('IgxTimePicker', () => { |
1766 | 1766 |
|
1767 | 1767 | describe('Hour/minute only mode', () => { |
1768 | 1768 | configureTestSuite(); |
1769 | | - let fixture, timePicker, dom, input; |
| 1769 | + let fixture: ComponentFixture<IgxTimePickerDropDownSingleHourComponent>, |
| 1770 | + timePicker: IgxTimePickerComponent, |
| 1771 | + dom: DebugElement, |
| 1772 | + input: DebugElement; |
1770 | 1773 |
|
1771 | 1774 | beforeEach( |
1772 | 1775 | async(() => { |
@@ -1841,6 +1844,21 @@ describe('IgxTimePicker', () => { |
1841 | 1844 | expect(_input.nativeElement.value).toEqual('12 AM'); |
1842 | 1845 | })); |
1843 | 1846 |
|
| 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 | + |
1844 | 1862 | it('Should navigate dropdown lists correctly when format contains only hours.', fakeAsync(() => { |
1845 | 1863 | fixture.componentInstance.format = 'hh tt'; |
1846 | 1864 | fixture.componentInstance.customDate = new Date(2018, 10, 27, 17, 45, 0); |
|
0 commit comments