From d8ee1f83bb83e2db5ea5c4d52ec03f7e102f94b6 Mon Sep 17 00:00:00 2001 From: Irina Ershova Date: Thu, 29 Mar 2018 12:14:09 +0300 Subject: [PATCH] feat(timepicker): add validation for timepicker (#3588) Add validation for timepicker based on jquery-ui validation. Fix min-max validation issue. close #3549 #3288 --- src/spec/timepicker/timepicker-controls.util.spec.ts | 1 - src/spec/timepicker/timepicker.utils.spec.ts | 8 ++++---- src/timepicker/reducer/timepicker.store.ts | 4 +--- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/spec/timepicker/timepicker-controls.util.spec.ts b/src/spec/timepicker/timepicker-controls.util.spec.ts index 6171eaf016..3e346fd637 100644 --- a/src/spec/timepicker/timepicker-controls.util.spec.ts +++ b/src/spec/timepicker/timepicker-controls.util.spec.ts @@ -242,6 +242,5 @@ describe('Util: Timepicker-controls', () => { expect(result.canDecrementHours).toEqual(false); expect(result.canDecrementMinutes).toEqual(false); - }); }); diff --git a/src/spec/timepicker/timepicker.utils.spec.ts b/src/spec/timepicker/timepicker.utils.spec.ts index 1d44d15cd0..2099c020c0 100644 --- a/src/spec/timepicker/timepicker.utils.spec.ts +++ b/src/spec/timepicker/timepicker.utils.spec.ts @@ -232,8 +232,8 @@ describe('Runtime coverage. Utils: Timepicker', () => { }); it('isInputLimitValid method should validate input according to the max limit and return false', () => { - const date = modelTime(2, 0, 0, true); - const max = changeTime(new Date(), modelTime(1, 0, 0, true)); + const date = modelTime(0, 0, 0, true); + const max = changeTime(new Date(), modelTime(-1, 0, 0, true)); const result = isInputLimitValid(date, max, null); @@ -241,8 +241,8 @@ describe('Runtime coverage. Utils: Timepicker', () => { }); it('isInputLimitValid method should validate input according to the min limit and return false', () => { - const date = modelTime(1, 0, 0, true); - const min = changeTime(new Date(), modelTime(3, 0, 0, true)); + const date = modelTime(0, 0, 0, true); + const min = changeTime(new Date(), modelTime(0, 30, 0, true)); const result = isInputLimitValid(date, null, min); diff --git a/src/timepicker/reducer/timepicker.store.ts b/src/timepicker/reducer/timepicker.store.ts index 695fcd129a..1fa87326e7 100644 --- a/src/timepicker/reducer/timepicker.store.ts +++ b/src/timepicker/reducer/timepicker.store.ts @@ -6,9 +6,7 @@ import { } from './timepicker.reducer'; import { BehaviorSubject } from 'rxjs/BehaviorSubject'; -import { Action } from '../../mini-ngrx/index'; -import { MiniStore } from '../../mini-ngrx/store.class'; -import { MiniState } from '../../mini-ngrx/state.class'; +import { Action, MiniStore, MiniState } from '../../mini-ngrx/index'; @Injectable() export class TimepickerStore extends MiniStore {