Skip to content

Commit

Permalink
feat(timepicker): add validation for timepicker (#3588)
Browse files Browse the repository at this point in the history
Add validation for timepicker based on jquery-ui validation.
Fix min-max validation issue.

close #3549 #3288
  • Loading branch information
IraErshova authored and valorkin committed Mar 29, 2018
1 parent b681cf1 commit d8ee1f8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
1 change: 0 additions & 1 deletion src/spec/timepicker/timepicker-controls.util.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,5 @@ describe('Util: Timepicker-controls', () => {

expect(result.canDecrementHours).toEqual(false);
expect(result.canDecrementMinutes).toEqual(false);

});
});
8 changes: 4 additions & 4 deletions src/spec/timepicker/timepicker.utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,17 +232,17 @@ 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);

expect(result).toEqual(false);
});

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);

Expand Down
4 changes: 1 addition & 3 deletions src/timepicker/reducer/timepicker.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<TimepickerState> {
Expand Down

0 comments on commit d8ee1f8

Please sign in to comment.