Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit cd75312

Browse files
committed
fix(): correctly access minErr
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.
1 parent 193153c commit cd75312

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/ngAnimate/shared.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ var isPromiseLike = function(p) {
7272
return p && p.then ? true : false;
7373
};
7474

75+
var ngMinErr = angular.$$minErr('ng');
7576
function assertArg(arg, name, reason) {
7677
if (!arg) {
7778
throw ngMinErr('areq', "Argument '{0}' is {1}", (name || '?'), (reason || "required"));

test/ngAnimate/animateSpec.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1408,7 +1408,24 @@ describe("animations", function() {
14081408
});
14091409
}));
14101410

1411-
it('should allow an element to pinned elsewhere and still be available in animations',
1411+
it('should complain if the arguments are not elements',
1412+
inject(function($animate, $compile, $document, $rootScope, $rootElement) {
1413+
1414+
var element = jqLite('<div></div>');
1415+
1416+
expect(function() {
1417+
$animate.pin(element);
1418+
}).toThrow();
1419+
1420+
expect(function() {
1421+
$animate.pin(null, $rootElement);
1422+
}).toThrow();
1423+
1424+
dealoc(element);
1425+
}));
1426+
1427+
1428+
it('should allow an element to be pinned elsewhere and still be available in animations',
14121429
inject(function($animate, $compile, $document, $rootElement, $rootScope) {
14131430

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

0 commit comments

Comments
 (0)