Skip to content
This repository was archived by the owner on Sep 8, 2020. It is now read-only.

Commit 41ddeb9

Browse files
committed
Fix unit tests
1 parent 1490a54 commit 41ddeb9

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

test/validateSpec.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ describe('uiValidate', function () {
3737
scope.validate = trueValidator;
3838
compileAndDigest('<input name="input" ng-model="value" ui-validate="\'validate($value)\'">', scope);
3939
expect(scope.form.input.$valid).toBeTruthy();
40-
expect(scope.form.input.$error).toEqual({validator: false});
40+
expect(scope.form.input.$error).toEqual({});
4141
}));
4242

4343
it('should mark input as invalid if initial model is invalid', inject(function () {
@@ -113,7 +113,7 @@ describe('uiValidate', function () {
113113
expect(scope.form.input.$error.validator).toBe(true);
114114
scope.$apply('watchMe=true');
115115
expect(scope.form.input.$valid).toBe(true);
116-
expect(scope.form.input.$error.validator).toBe(false);
116+
expect(scope.form.input.$error.validator).toBeUndefined();
117117
});
118118

119119
it('should watch the string and refire all validators', function () {
@@ -124,8 +124,8 @@ describe('uiValidate', function () {
124124
expect(scope.form.input.$error.bar).toBe(true);
125125
scope.$apply('watchMe=true');
126126
expect(scope.form.input.$valid).toBe(true);
127-
expect(scope.form.input.$error.foo).toBe(false);
128-
expect(scope.form.input.$error.bar).toBe(false);
127+
expect(scope.form.input.$error.foo).toBeUndefined();
128+
expect(scope.form.input.$error.bar).toBeUndefined();
129129
});
130130

131131
it('should watch the all object attributes and each respective validator', function () {
@@ -137,17 +137,17 @@ describe('uiValidate', function () {
137137
expect(scope.form.input.$error.bar).toBe(true);
138138
scope.$apply('watchFoo=true');
139139
expect(scope.form.input.$valid).toBe(false);
140-
expect(scope.form.input.$error.foo).toBe(false);
140+
expect(scope.form.input.$error.foo).toBeUndefined();
141141
expect(scope.form.input.$error.bar).toBe(true);
142142
scope.$apply('watchBar=true');
143143
scope.$apply('watchFoo=false');
144144
expect(scope.form.input.$valid).toBe(false);
145145
expect(scope.form.input.$error.foo).toBe(true);
146-
expect(scope.form.input.$error.bar).toBe(false);
146+
expect(scope.form.input.$error.bar).toBeUndefined();
147147
scope.$apply('watchFoo=true');
148148
expect(scope.form.input.$valid).toBe(true);
149-
expect(scope.form.input.$error.foo).toBe(false);
150-
expect(scope.form.input.$error.bar).toBe(false);
149+
expect(scope.form.input.$error.foo).toBeUndefined();
150+
expect(scope.form.input.$error.bar).toBeUndefined();
151151
});
152152

153153
});
@@ -156,7 +156,7 @@ describe('uiValidate', function () {
156156
it('should fail if ngModel not present', inject(function () {
157157
expect(function () {
158158
compileAndDigest('<input name="input" ui-validate="\'validate($value)\'">', scope);
159-
}).toThrow(new Error('No controller: ngModel'));
159+
}).toThrow();
160160
}));
161161
it('should have no effect if validate expression is empty', inject(function () {
162162
compileAndDigest('<input ng-model="value" ui-validate="">', scope);

0 commit comments

Comments
 (0)