Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian FERBACH committed Apr 3, 2017
1 parent cafc44e commit 718b010
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/javascripts/test/unit/Crud/field/maDateFieldSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,21 @@ describe('directive: date-field', function() {

expect(isolatedScope.value).toBe('2010-01-01');
});

it('should not update value if input is invalid', () => {
const now = '2016-09-18';
scope.value = now;
scope.field = new DateField();

const element = $compile(directiveUsage)(scope);
const isolatedScope = element.isolateScope();

element.find('input').val('2016-09-1').triggerHandler('input');
isolatedScope.$digest();
expect(isolatedScope.value).toBe('2016-09-18');

element.find('input').val('2016-09-19').triggerHandler('input');
isolatedScope.$digest();
expect(isolatedScope.value).toBe('2016-09-19');
})
});

0 comments on commit 718b010

Please sign in to comment.