Skip to content

Commit bb4a763

Browse files
committed
Fix setValidity in validation-group tests
1 parent 58dc25a commit bb4a763

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

‎test/unit/validationGroupSpec.js‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ describe('validation-group directive', function() {
124124
$compile = $injector.get('$compile');
125125
$scope = $rootScope.$new();
126126

127-
element = $compile('<form name="Form"><input type="text" name="email" ng-model="email" validator="required" validation-group="contact"><input type="number" name="telephone" ng-model="telephone" validator="number" validation-group="contact"><span id="contact"></span></form>')($scope);
127+
element = $compile('<form name="Form"><input type="text" name="email" ng-model="email" validator="email" validation-group="contact"><input type="text" name="telephone" ng-model="telephone" validator="number" validation-group="contact"><span id="contact"></span></form>')($scope);
128128
angular.element(document.body).append(element);
129129
$scope.$digest();
130130
}));
@@ -154,8 +154,8 @@ describe('validation-group directive', function() {
154154
it('should be dirty and invalid', function() {
155155
$scope.Form.email.$setViewValue('[email protected]');
156156
$scope.Form.telephone.$setViewValue('065839481');
157-
$scope.Form.email.$setViewValue();
158-
$scope.Form.telephone.$setViewValue();
157+
$scope.Form.email.$setViewValue('');
158+
$scope.Form.telephone.$setViewValue('');
159159

160160
expect($scope.Form.$dirty).toBe(true);
161161
expect(element.hasClass('ng-dirty')).toBe(true);
@@ -188,7 +188,7 @@ describe('validation-group directive', function() {
188188

189189
it('should have an error message inside the #contact element when no element is valid', function() {
190190
$scope.Form.email.$setViewValue('[email protected]');
191-
$scope.Form.email.$setViewValue();
191+
$scope.Form.email.$setViewValue('');
192192

193193
messageElem = angular.element(element[0].querySelector('#contact > p'));
194194
expect(messageElem.hasClass('validation-invalid')).toBe(true);
@@ -205,7 +205,7 @@ describe('validation-group directive', function() {
205205
it('should have a success message inside the #contact element when one of element is valid', function() {
206206
$scope.Form.email.$setViewValue('[email protected]');
207207
$scope.Form.telephone.$setViewValue('065839481');
208-
$scope.Form.email.$setViewValue();
208+
$scope.Form.email.$setViewValue('');
209209

210210
messageElem = angular.element(element[0].querySelector('#contact > p'));
211211
expect(messageElem.hasClass('validation-valid')).toBe(true);
@@ -214,8 +214,8 @@ describe('validation-group directive', function() {
214214
it('should have an error message inside the #contact element when both of elements are invalid', function() {
215215
$scope.Form.email.$setViewValue('[email protected]');
216216
$scope.Form.telephone.$setViewValue('065839481');
217-
$scope.Form.email.$setViewValue();
218-
$scope.Form.telephone.$setViewValue();
217+
$scope.Form.email.$setViewValue('');
218+
$scope.Form.telephone.$setViewValue('');
219219

220220
messageElem = angular.element(element[0].querySelector('#contact > p'));
221221
expect(messageElem.hasClass('validation-invalid')).toBe(true);
@@ -323,6 +323,7 @@ describe('validation-group directive', function() {
323323
errorSpy = jasmine.createSpy('errorSpy');
324324

325325
$scope.Form.checkbox1.$setViewValue(true);
326+
$scope.Form.checkbox1.$setViewValue(false);
326327

327328
validationProvider.validate($scope.Form)
328329
.success(function() {

0 commit comments

Comments
 (0)