@@ -12,7 +12,7 @@ import { InteractionMode } from '../core/enums';
12
12
import { IgxIconModule } from '../icon' ;
13
13
import { IgxToggleModule } from '../directives/toggle/toggle.directive' ;
14
14
import { CancelableBrowserEventArgs , IBaseEventArgs } from '../core/utils' ;
15
- import { IgxHourItemDirective , IgxItemListDirective , IgxMinuteItemDirective , IgxSecondsItemDirective , IgxAmPmItemDirective } from './time-picker.directives' ;
15
+ import { IgxHourItemDirective , IgxMinuteItemDirective , IgxSecondsItemDirective , IgxAmPmItemDirective } from './time-picker.directives' ;
16
16
17
17
// tslint:disable: no-use-before-declare
18
18
describe ( 'IgxTimePicker' , ( ) => {
@@ -1677,43 +1677,65 @@ describe('IgxTimePicker', () => {
1677
1677
timePicker . minValue = '09:15:10 AM' ;
1678
1678
timePicker . maxValue = '11:15:10 AM' ;
1679
1679
1680
- // timePicker.minValue = '06:45:57 AM';
1681
- // timePicker.maxValue = '6:55:59 PM';
1682
-
1683
- fixture . detectChanges ( ) ;
1684
- const minValue = timePicker . convertMinMaxValue ( timePicker . minValue ) ;
1685
- const maxValue = timePicker . convertMinMaxValue ( timePicker . maxValue ) ;
1686
1680
fixture . detectChanges ( ) ;
1687
1681
timePicker . value = date ;
1688
1682
1689
- const iconTime = dom . queryAll ( By . css ( '.igx-icon' ) ) [ 0 ] ;
1690
- UIInteractions . simulateClickAndSelectEvent ( iconTime ) ;
1683
+ timePicker . openDialog ( ) ;
1691
1684
fixture . detectChanges ( ) ;
1692
1685
const hoursList = fixture . debugElement . queryAll ( By . directive ( IgxHourItemDirective ) ) ;
1693
1686
const minutesList = fixture . debugElement . queryAll ( By . directive ( IgxMinuteItemDirective ) ) ;
1694
1687
const secondsList = fixture . debugElement . queryAll ( By . directive ( IgxSecondsItemDirective ) ) ;
1695
1688
const ampmList = fixture . debugElement . queryAll ( By . directive ( IgxAmPmItemDirective ) ) ;
1696
1689
1697
1690
let hoursListItem = ( hoursList . find ( t => t . nativeElement . innerHTML === '09' ) ) . injector . get ( IgxHourItemDirective ) ;
1698
- fixture . detectChanges ( ) ;
1699
1691
let minutesListItem = ( minutesList . find ( t => t . nativeElement . innerHTML === '55' ) ) . injector . get ( IgxMinuteItemDirective ) ;
1700
- fixture . detectChanges ( ) ;
1701
1692
let secondsListItem = ( secondsList . find ( t => t . nativeElement . innerHTML === '58' ) ) . injector . get ( IgxSecondsItemDirective ) ;
1702
- fixture . detectChanges ( ) ;
1693
+ let ampmListItem = ( ampmList . find ( t => t . nativeElement . innerHTML === 'AM' ) ) . injector . get ( IgxAmPmItemDirective ) ;
1703
1694
1704
1695
expect ( hoursListItem . applyDisabledStyleForHours ) . toBe ( false ) ;
1705
1696
expect ( minutesListItem . applyDisabledStyleForMinutes ) . toBe ( false ) ;
1706
1697
expect ( secondsListItem . applyDisabledStyleForSeconds ) . toBe ( false ) ;
1698
+ expect ( ampmListItem . applyDisabledStyleForAmPm ) . toBe ( false ) ;
1707
1699
1708
- hoursListItem = ( hoursList . find ( t => t . nativeElement . innerHTML === '06' ) ) . injector . get ( IgxHourItemDirective ) ;
1700
+ timePicker . scrollAmPmIntoView ( 'PM' ) ;
1709
1701
fixture . detectChanges ( ) ;
1702
+ ampmListItem = ( ampmList . find ( t => t . nativeElement . innerHTML === 'PM' ) ) . injector . get ( IgxAmPmItemDirective ) ;
1703
+
1704
+ expect ( hoursListItem . applyDisabledStyleForHours ) . toBe ( true ) ;
1705
+ expect ( minutesListItem . applyDisabledStyleForMinutes ) . toBe ( true ) ;
1706
+ expect ( secondsListItem . applyDisabledStyleForSeconds ) . toBe ( true ) ;
1707
+ expect ( ampmListItem . applyDisabledStyleForAmPm ) . toBe ( true ) ;
1708
+
1709
+ hoursListItem = ( hoursList . find ( t => t . nativeElement . innerHTML === '06' ) ) . injector . get ( IgxHourItemDirective ) ;
1710
1710
minutesListItem = ( minutesList . find ( t => t . nativeElement . innerHTML === '35' ) ) . injector . get ( IgxMinuteItemDirective ) ;
1711
- fixture . detectChanges ( ) ;
1712
1711
secondsListItem = ( secondsList . find ( t => t . nativeElement . innerHTML === '55' ) ) . injector . get ( IgxSecondsItemDirective ) ;
1713
- fixture . detectChanges ( ) ;
1712
+
1714
1713
expect ( hoursListItem . applyDisabledStyleForHours ) . toBe ( true ) ;
1715
1714
expect ( minutesListItem . applyDisabledStyleForMinutes ) . toBe ( true ) ;
1716
1715
expect ( secondsListItem . applyDisabledStyleForSeconds ) . toBe ( true ) ;
1716
+ expect ( ampmListItem . applyDisabledStyleForAmPm ) . toBe ( true ) ;
1717
+
1718
+ timePicker . minValue = '06:45:57 AM' ;
1719
+ timePicker . maxValue = '06:55:59 AM' ;
1720
+
1721
+ hoursListItem = ( hoursList . find ( t => t . nativeElement . innerHTML === '06' ) ) . injector . get ( IgxHourItemDirective ) ;
1722
+ minutesListItem = ( minutesList . find ( t => t . nativeElement . innerHTML === '50' ) ) . injector . get ( IgxMinuteItemDirective ) ;
1723
+ secondsListItem = ( secondsList . find ( t => t . nativeElement . innerHTML === '58' ) ) . injector . get ( IgxSecondsItemDirective ) ;
1724
+ ampmListItem = ( ampmList . find ( t => t . nativeElement . innerHTML === 'AM' ) ) . injector . get ( IgxAmPmItemDirective ) ;
1725
+
1726
+ timePicker . scrollHourIntoView ( '06' ) ;
1727
+ fixture . detectChanges ( ) ;
1728
+ timePicker . scrollMinuteIntoView ( '50' ) ;
1729
+ fixture . detectChanges ( ) ;
1730
+ timePicker . scrollSecondsIntoView ( '58' ) ;
1731
+ fixture . detectChanges ( ) ;
1732
+ timePicker . scrollAmPmIntoView ( 'AM' ) ;
1733
+ fixture . detectChanges ( ) ;
1734
+
1735
+ expect ( hoursListItem . applyDisabledStyleForHours ) . toBe ( false ) ;
1736
+ expect ( minutesListItem . applyDisabledStyleForMinutes ) . toBe ( false ) ;
1737
+ expect ( secondsListItem . applyDisabledStyleForSeconds ) . toBe ( false ) ;
1738
+ expect ( ampmListItem . applyDisabledStyleForAmPm ) . toBe ( false ) ;
1717
1739
} ) ) ;
1718
1740
} ) ;
1719
1741
0 commit comments