aboutsummaryrefslogtreecommitdiffstats
path: root/test/ValidatorsTest.js
diff options
context:
space:
mode:
authorMisko Hevery2010-02-12 14:16:33 -0800
committerMisko Hevery2010-02-12 14:17:44 -0800
commit6cc946413622f1cef97997849e73a06a00f876fd (patch)
treeb0e4e10405fc8cd91e6d55507b3a6a02528928a9 /test/ValidatorsTest.js
parentb2a8a089b6c31c8ff176c2483f659caae4f71afb (diff)
downloadangular.js-6cc946413622f1cef97997849e73a06a00f876fd.tar.bz2
Fixed negation grouping bug
Make 'this' of validation be scope
Diffstat (limited to 'test/ValidatorsTest.js')
-rw-r--r--test/ValidatorsTest.js18
1 files changed, 17 insertions, 1 deletions
diff --git a/test/ValidatorsTest.js b/test/ValidatorsTest.js
index f06e0b3a..a4e603fa 100644
--- a/test/ValidatorsTest.js
+++ b/test/ValidatorsTest.js
@@ -1,5 +1,22 @@
ValidatorTest = TestCase('ValidatorTest');
+ValidatorTest.prototype.testItShouldHaveThisSet = function() {
+ expectAsserts(5);
+ var self;
+ angular.validator.myValidator = function(first, last){
+ assertEquals('misko', first);
+ assertEquals('hevery', last);
+ self = this;
+ };
+ var c = compile('<input name="name" ng-validate="myValidator:\'hevery\'"/>');
+ c.scope.set('name', 'misko');
+ c.scope.set('state', 'abc');
+ c.binder.updateView();
+ assertEquals('abc', self.state);
+ assertEquals('misko', self.name);
+ assertEquals('name', self.$element.name);
+};
+
ValidatorTest.prototype.testRegexp = function() {
assertEquals(angular.validator.regexp("abc", /x/, "E1"), "E1");
assertEquals(angular.validator.regexp("abc", '/x/'),
@@ -64,4 +81,3 @@ ValidatorTest.prototype.testJson = function() {
assertNotNull(angular.validator.json("''X"));
assertNull(angular.validator.json("{}"));
};
-