validation Presence() unit tests for ng-invalid class

This commit is contained in:
Carlos Jimenez 2018-01-02 08:17:40 +01:00
parent 8c6131322f
commit 12b3342953
1 changed files with 1 additions and 7 deletions

View File

@ -55,10 +55,7 @@ describe('Directive validation', () => {
let html = `<form><input type="name" ng-model="user.name" vn-validation="user.name"/></form>`;
let validations = {User: {validations: {name: [{validation: 'presence'}]}}};
compile(html, validations, 'spiderman');
scope.user.email = '1234?';
expect(element[0].classList).toContain('ng-valid');
expect(element[0].classList).not.toContain('ng-invalid');
scope.user.name = '';
scope.$digest();
expect(element[0].classList).toContain('ng-invalid');
@ -70,9 +67,6 @@ describe('Directive validation', () => {
let validations = {User: {validations: {email: [{validation: 'presence'}]}}};
compile(html, validations, 'user@verdnatura.es');
scope.user.email = 'user@verdnatura.es';
expect(element[0].classList).toContain('ng-valid');
expect(element[0].classList).not.toContain('ng-invalid');
scope.$digest();
expect(element[0].classList).toContain('ng-valid');