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

Commit 9bc4ee8

Browse files
BobChao87petebacondarwin
authored andcommitted
refactor(ngModelSpec): use valueFn over curry
Refactor ngModelSpec to use internal helper function `valueFn`. Use instead of multiple-defining a function called `curry`. PR (#15231) Addresses a quick change mentioned in PR 15208 from Issue #14734
1 parent b1c9075 commit 9bc4ee8

File tree

1 file changed

+7
-19
lines changed

1 file changed

+7
-19
lines changed

test/ng/directive/ngModelSpec.js

+7-19
Original file line numberDiff line numberDiff line change
@@ -827,38 +827,26 @@ describe('ngModel', function() {
827827

828828

829829
it('should only validate to true if all validations are true', function() {
830-
var curry = function(v) {
831-
return function() {
832-
return v;
833-
};
834-
};
835-
836830
ctrl.$modelValue = undefined;
837-
ctrl.$validators.a = curry(true);
838-
ctrl.$validators.b = curry(true);
839-
ctrl.$validators.c = curry(false);
831+
ctrl.$validators.a = valueFn(true);
832+
ctrl.$validators.b = valueFn(true);
833+
ctrl.$validators.c = valueFn(false);
840834

841835
ctrl.$validate();
842836
expect(ctrl.$valid).toBe(false);
843837

844-
ctrl.$validators.c = curry(true);
838+
ctrl.$validators.c = valueFn(true);
845839

846840
ctrl.$validate();
847841
expect(ctrl.$valid).toBe(true);
848842
});
849843

850844

851845
it('should register invalid validations on the $error object', function() {
852-
var curry = function(v) {
853-
return function() {
854-
return v;
855-
};
856-
};
857-
858846
ctrl.$modelValue = undefined;
859-
ctrl.$validators.unique = curry(false);
860-
ctrl.$validators.tooLong = curry(false);
861-
ctrl.$validators.notNumeric = curry(true);
847+
ctrl.$validators.unique = valueFn(false);
848+
ctrl.$validators.tooLong = valueFn(false);
849+
ctrl.$validators.notNumeric = valueFn(true);
862850

863851
ctrl.$validate();
864852

0 commit comments

Comments
 (0)