Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

refactor(ngModelSpec): use valueFn over curry #15231

Merged
merged 1 commit into from
Oct 9, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 7 additions & 19 deletions test/ng/directive/ngModelSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -827,21 +827,15 @@ describe('ngModel', function() {


it('should only validate to true if all validations are true', function() {
var curry = function(v) {
return function() {
return v;
};
};

ctrl.$modelValue = undefined;
ctrl.$validators.a = curry(true);
ctrl.$validators.b = curry(true);
ctrl.$validators.c = curry(false);
ctrl.$validators.a = valueFn(true);
ctrl.$validators.b = valueFn(true);
ctrl.$validators.c = valueFn(false);

ctrl.$validate();
expect(ctrl.$valid).toBe(false);

ctrl.$validators.c = curry(true);
ctrl.$validators.c = valueFn(true);

ctrl.$validate();
expect(ctrl.$valid).toBe(true);
Expand Down Expand Up @@ -875,16 +869,10 @@ describe('ngModel', function() {


it('should register invalid validations on the $error object', function() {
var curry = function(v) {
return function() {
return v;
};
};

ctrl.$modelValue = undefined;
ctrl.$validators.unique = curry(false);
ctrl.$validators.tooLong = curry(false);
ctrl.$validators.notNumeric = curry(true);
ctrl.$validators.unique = valueFn(false);
ctrl.$validators.tooLong = valueFn(false);
ctrl.$validators.notNumeric = valueFn(true);

ctrl.$validate();

Expand Down