Skip to content

Commit

Permalink
fix(): correctly access minErr
Browse files Browse the repository at this point in the history
ngMinErr is not available in the build, but it is available
during unit tests. The added tests don't actually catch this error,
they have just been added for completeness.
  • Loading branch information
Narretz committed Dec 8, 2015
1 parent 193153c commit cd75312
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/ngAnimate/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ var isPromiseLike = function(p) {
return p && p.then ? true : false;
};

var ngMinErr = angular.$$minErr('ng');
function assertArg(arg, name, reason) {
if (!arg) {
throw ngMinErr('areq', "Argument '{0}' is {1}", (name || '?'), (reason || "required"));
Expand Down
19 changes: 18 additions & 1 deletion test/ngAnimate/animateSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1408,7 +1408,24 @@ describe("animations", function() {
});
}));

it('should allow an element to pinned elsewhere and still be available in animations',
it('should complain if the arguments are not elements',
inject(function($animate, $compile, $document, $rootScope, $rootElement) {

var element = jqLite('<div></div>');

expect(function() {
$animate.pin(element);
}).toThrow();

expect(function() {
$animate.pin(null, $rootElement);
}).toThrow();

dealoc(element);
}));


it('should allow an element to be pinned elsewhere and still be available in animations',
inject(function($animate, $compile, $document, $rootElement, $rootScope) {

var innerParent = jqLite('<div></div>');
Expand Down

0 comments on commit cd75312

Please sign in to comment.