From 200985eb241900075a9a08263a99c0f7ec34bfdc Mon Sep 17 00:00:00 2001 From: Martin Staffa Date: Thu, 10 Dec 2015 13:25:41 +0100 Subject: [PATCH] test($animate): ensure that pin() arguments are elements --- test/ngAnimate/animateSpec.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/test/ngAnimate/animateSpec.js b/test/ngAnimate/animateSpec.js index cdc91a59312d..713170820d2c 100644 --- a/test/ngAnimate/animateSpec.js +++ b/test/ngAnimate/animateSpec.js @@ -1431,7 +1431,24 @@ describe("animations", function() { }); })); - it('should allow an element to pinned elsewhere and still be available in animations', + it('should throw if the arguments are not elements', + inject(function($animate, $compile, $document, $rootScope, $rootElement) { + + var element = jqLite('
'); + + expect(function() { + $animate.pin(element); + }).toThrowMinErr('ng', 'areq', 'Argument \'parentElement\' is not an element'); + + expect(function() { + $animate.pin(null, $rootElement); + }).toThrowMinErr('ng', 'areq', 'Argument \'element\' is not an element'); + + 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('
');