diff --git a/src/spec/timepicker/timepicker.component.spec.ts b/src/spec/timepicker/timepicker.component.spec.ts index d48f44be8a..a553b0a5d7 100644 --- a/src/spec/timepicker/timepicker.component.spec.ts +++ b/src/spec/timepicker/timepicker.component.spec.ts @@ -3,12 +3,32 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { TimepickerComponent } from '../../timepicker/timepicker.component'; import { TimepickerConfig } from '../../timepicker/timepicker.config'; import { TimepickerActions } from '../../timepicker/reducer/timepicker.actions'; -import { Data } from '@angular/router'; + +/*function createComponent(htmlTemplate, dtc?: string): ComponentFixture { + switch (dtc) { + case 'OnPush': + TestBed.overrideComponent(TimepickerComponent, { + set: { + template: htmlTemplate, + changeDetection: ChangeDetectionStrategy.OnPush + } + }); + break; + default: + TestBed.overrideComponent(TimepickerComponent, { + set: {template: htmlTemplate} + }); + } + + const fixture = TestBed.createComponent(TimepickerComponent); + fixture.detectChanges(); + return fixture as ComponentFixture; +}*/ describe('Component: timepicker', () => { let fixture: ComponentFixture; let context: TimepickerComponent; - let nativeEl: any; + let nativeElement: any; beforeEach(() => { TestBed.configureTestingModule({ @@ -21,155 +41,100 @@ describe('Component: timepicker', () => { fixture = TestBed.createComponent(TimepickerComponent); context = fixture.componentInstance; - nativeEl = fixture.nativeElement; + nativeElement = fixture.nativeElement; fixture.detectChanges(); }); - it('should prevDef', () => { - context.prevDef(new Event('customWheel')); - }); - - it('should wheelSign', () => { - context.wheelSign(new Event('customWheel')); - }); - - // it('should canBeChanged wheel', () => { - // context.mousewheel = false; - // context.canBeChanged('wheel'); - // }); - // - // it('should canBeChanged key', () => { - // context.arrowkeys = false; - // context.canBeChanged('key'); - // }); - // - // it('should canBeChanged true', () => { - // context.readonlyInput = true; - // context.canBeChanged(); - // }); - - it('should changeHours', () => { - context.changeHours(3); - }); - - it('should changeHours canIncrementHours', () => { - context.canIncrementHours = false; - context.changeHours(3); - }); - - it('should changeHours canDecrementHours', () => { - context.canDecrementHours = false; - context.changeHours(-3); - }); - - it('should changeHours wheel', () => { - context.mousewheel = false; - context.changeHours(3, 'wheel'); - }); - - it('should changeMinutes', () => { - context.changeMinutes(3); - }); - - it('should changeMinutes canIncrementHours', () => { - context.canIncrementMinutes = false; - context.changeMinutes(3); - }); - - it('should changeMinutes canDecrementHours', () => { - context.canDecrementMinutes = false; - context.changeMinutes(-3); - }); - - it('should changeMinutes wheel', () => { - context.mousewheel = false; - context.changeMinutes(3, 'wheel'); - }); - - it('should changeSeconds', () => { - context.changeSeconds(3); - }); - - it('should changeSeconds canIncrementHours', () => { - context.canIncrementSeconds = false; - context.changeSeconds(3); - }); - - it('should changeSeconds canDecrementHours', () => { - context.canDecrementSeconds = false; - context.changeSeconds(-3); - }); - - it('should changeSeconds wheel', () => { - context.mousewheel = false; - context.changeSeconds(3, 'wheel'); - }); - - it('should updateHours', () => { - context.readonlyInput = true; - context.updateHours('0'); - }); - - it('should updateHours', () => { - context.updateHours(''); - context.updateHours('-1'); - context.updateHours('1'); - }); - - it('should updateMinutes', () => { - context.readonlyInput = true; - context.updateMinutes('0'); - }); - - it('should updateMinutes', () => { - context.updateMinutes(''); - context.updateMinutes('-1'); - context.updateMinutes('1'); - }); - - it('should updateSeconds', () => { - context.readonlyInput = true; - context.updateSeconds('0'); - }); - - it('should updateSeconds', () => { - context.updateSeconds(''); - context.updateSeconds('-1'); - context.updateSeconds('1'); - }); - - it('should toggleMeridian true', () => { - context.showMeridian = true; - context.toggleMeridian(); - }); - - it('should toggleMeridian false', () => { - context.showMeridian = false; - context.toggleMeridian(); - }); - - it('should writeValue', () => { - context.writeValue('1'); - }); - - it('should writeValue', () => { - context.writeValue(''); - }); - - it('should registerOnChange', () => { - context.registerOnChange((val: any) => val); - }); - - it('should registerOnTouched', () => { - context.registerOnTouched(() => true); - }); - - it('should setDisabledState', () => { - context.setDisabledState(true); - }); - - it('should showMeridian change', () => { - context.showMeridian = false; - (context as any)._renderTime('-1'); - }); + // validate input fields + + // проверить данные в поле минуты + it('should validate the data in the minutes input', () => {}); + // проверить данные в поле секунды + it('should validate the data in the seconds input', () => {}); + // изменить активный инпут после нажатия Enter + it('should change the active input field after enter click', () => {}); + // автоматически заполнить поле ввода, после enter, если введдено не полное значение + it('should auto complete input field after enter click if enter half value', () => {}); + // автоматическая очистить поля при вводе не корректного значения + it('should auto clean input field after enter invalid value', () => {}); + // отобразить ошибки на поеле, после ввода не корректного значения + it('should display error input field after enter invalid value', () => {}); + + // validate input fields with property of 'showMeridian' + + // отобразить кнопку AM/PM при состоянии showMeridian по умолчанию + it('should default state showMeridian display AM/PM button', () => {}); + // отобразить время в формате времени 12h + it('should display time at time format 12h', () => {}); + // проверить данные в поле ввода Часы при вормате времени 12h + it('should validate the data in the hours input at time format 12h', () => {}); + // изменить временной период после клика на кнопку AM/PM + it('should change time period after click on AM/PM button', () => {}); + // не отобразить кнопку AM/PM если showMeridian выключен + it('should not display AM/PM button if showMeridian switch off', () => {}); + // отобразить время в формате времени 24h + it('should display time at time format 24h', () => {}); + // проверить данные в поле часы при формате времени 24h + it('should validate the data in the hours input at time format 24h', () => {}); + + // validate input fields with property of 'max' + + // не должно превысить значение поля ввода указанного значения + it('should not value of the input field exceed the specified value', () => {}); + // изменить значение поля ввода на указанное максимальное значение значение, если оно приывшает указанное максимальное значение + it('should change the input field to specified value if it exceed the specified value', () => {}); + + // validate input fields with property of 'min' + + // не должно быть меньше значения поля ввода указанного значения + it('should not value of the input field less the specified value', () => {}); + // изменить значение поля ввода на указанное минимальное значение значение, если оно приывшает указанное минимальное значение + it('should change the input field to specified value if it less the specified value', () => {}); + + // display seconds fields with property of 'showSeconds' + + // не отображать поле секунды при значении showSeconds по умолчанию + it('should default state showSeconds is not display seconds field', () => {}); + // отображать поле секунды если showSeconds включен + it('should display seconds field if showMeridian switch on', () => {}); + + // display seconds fields with property of 'readonlyInput' + + // должна быть возможность ввода значений + it('should be possible to enter values', () => {}); + // должна отображать кнопки изменения времени + it('should be display is time change buttons', () => {}); + // не должно быть возможности ввода значений + it('should be impossible to enter values', () => {}); + // не должны отображаться кнопки изменения времени + it('should be not display is time change buttons', () => {}); + + // display seconds fields with property of 'hourStep' + it('should add to the hour input field value, hourStep value', () => {}); + it('should subtract to the hour input field value, hourStep value', () => {}); + + // display seconds fields with property of 'minuteStep' + it('should add to the minute input field value, minuteStep value', () => {}); + it('should subtract to the minute input field value, minuteStep value', () => {}); + + // default configuration + it('should be empty input fields', () => {}); + it('should set time in a input field after click on input change button', () => {}); + + // hide change button + it('should display change button in default state', () => {}); + it('should hide change button', () => {}); + + // validate 'mousewheel' + it('should can change input value with the mouse wheel', () => {}); + it('should can not change input value with the mouse wheel', () => {}); + + // validate 'arrowkeys' + it('should can change input value with the arrow keys', () => {}); + it('should can not change input value with the arrow keys', () => {}); + + // custom validate + it('should leave the input fields not specified', () => {}); + it('should valid value in input fields', () => {}); + it('should invalid value in input fields', () => {}); });