Skip to content

Commit

Permalink
Update: adding incomplete test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
hueitan committed Jan 5, 2016
1 parent bde6ce7 commit 5b3c761
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/unit/directivesSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,20 @@ describe('directives', function() {
display = element.find('span').css('display');
expect(display).toBe('block');
}));

it('given invalid validator', inject(function() {
console.error = function(msg) {
expect(msg).toBe('You are using undefined validator "%s"');
};

element = $compile('<form name="Form"><input type="text" name="required" ng-model="required" validator="haha"></form>')($scope);
$timeout.flush();

$scope.$apply(function() {
$scope.required = 'true';
});

}));
});

describe('Message-id attribute', function() {
Expand Down
12 changes: 12 additions & 0 deletions test/unit/providerSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,18 @@ describe('provider', function() {
expect(errorSpy2).toHaveBeenCalled();
}));

it('validate invalid form', inject(function() {
console.error = function(msg) {
expect(msg).toBe('This is not a regular Form name scope');
};

element = $compile('<form name="Form"><input type="text" name="required" ng-model="required" validator="required"></form>')($scope);
$timeout.flush();

validationProvider.validate($scope.Form2);

}));

it('set/get validMethod', inject(function() {
expect(validationProvider.getValidMethod()).toEqual(null);

Expand Down

0 comments on commit 5b3c761

Please sign in to comment.