aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDmitry Shirokov2013-10-20 20:07:50 -0700
committerMatias Niemelä2013-10-24 09:19:55 -0400
commit4b653aeac1aca7ac551738870a2446b6810ca0df (patch)
tree68b1ad607e2488ce440b1184480312b8cfb7afd3 /test
parent269bc7e51f0ae4e4230308e43db934a9fff48756 (diff)
downloadangular.js-4b653aeac1aca7ac551738870a2446b6810ca0df.tar.bz2
fix(input): keep track of min/max attars on-the-fly
Now input[type=button] keeps track of both min and max attrs even if they change over time.
Diffstat (limited to 'test')
-rw-r--r--test/ng/directive/inputSpec.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/ng/directive/inputSpec.js b/test/ng/directive/inputSpec.js
index c94eb9b8..c60960f0 100644
--- a/test/ng/directive/inputSpec.js
+++ b/test/ng/directive/inputSpec.js
@@ -667,6 +667,21 @@ describe('input', function() {
expect(scope.value).toBe(100);
expect(scope.form.alias.$error.min).toBeFalsy();
});
+
+ it('should validate even if min value changes on-the-fly', function(done) {
+ scope.min = 10;
+ compileInput('<input type="number" ng-model="value" name="alias" min="{{min}}" />');
+ scope.$digest();
+
+ changeInputValueTo('5');
+ expect(inputElm).toBeInvalid();
+
+ scope.min = 0;
+ scope.$digest(function () {
+ expect(inputElm).toBeValid();
+ done();
+ });
+ });
});
@@ -686,6 +701,21 @@ describe('input', function() {
expect(scope.value).toBe(0);
expect(scope.form.alias.$error.max).toBeFalsy();
});
+
+ it('should validate even if max value changes on-the-fly', function(done) {
+ scope.max = 10;
+ compileInput('<input type="number" ng-model="value" name="alias" max="{{max}}" />');
+ scope.$digest();
+
+ changeInputValueTo('5');
+ expect(inputElm).toBeValid();
+
+ scope.max = 0;
+ scope.$digest(function () {
+ expect(inputElm).toBeInvalid();
+ done();
+ });
+ });
});