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

Commit 3881831

Browse files
committed
revert: fix(ngAnimate): throw an error if a callback is passed to animate methods
This reverts commit 39b078b.
1 parent 9e3f82b commit 3881831

File tree

4 files changed

+0
-91
lines changed

4 files changed

+0
-91
lines changed

src/ng/animate.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -170,12 +170,6 @@ var $AnimateProvider = ['$provide', function($provide) {
170170
* page}.
171171
*/
172172
return {
173-
$$assertNoCallback: function(param) {
174-
if (isFunction(param)) {
175-
throw $animateMinErr('nocb', 'Do not pass a callback to animate methods');
176-
}
177-
},
178-
179173
animate: function(element, from, to) {
180174
applyStyles(element, { from: from, to: to });
181175
return asyncPromise();
@@ -198,8 +192,6 @@ var $AnimateProvider = ['$provide', function($provide) {
198192
* @return {Promise} the animation callback promise
199193
*/
200194
enter: function(element, parent, after, options) {
201-
this.$$assertNoCallback(options);
202-
203195
applyStyles(element, options);
204196
after ? after.after(element)
205197
: parent.prepend(element);
@@ -218,8 +210,6 @@ var $AnimateProvider = ['$provide', function($provide) {
218210
* @return {Promise} the animation callback promise
219211
*/
220212
leave: function(element, options) {
221-
this.$$assertNoCallback(options);
222-
223213
applyStyles(element, options);
224214
element.remove();
225215
return asyncPromise();
@@ -322,8 +312,6 @@ var $AnimateProvider = ['$provide', function($provide) {
322312
* @return {Promise} the animation callback promise
323313
*/
324314
setClass: function(element, add, remove, options) {
325-
this.$$assertNoCallback(options);
326-
327315
var self = this;
328316
var STORAGE_KEY = '$$animateClasses';
329317
var createdCache = false;

src/ngAnimate/animate.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -548,8 +548,6 @@ angular.module('ngAnimate', ['ng'])
548548
options.tempClasses = options.tempClasses.split(/\s+/);
549549
}
550550
return options;
551-
} else {
552-
$delegate.$$assertNoCallback(options);
553551
}
554552
}
555553

test/ng/animateSpec.js

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -177,45 +177,6 @@ describe("$animate", function() {
177177
}));
178178
});
179179

180-
it('should throw an error when a callback function is passed as the options param',
181-
inject(function($animate, $rootScope, $document, $rootElement) {
182-
183-
var invalidCallback = function() { };
184-
var element = jqLite('<div></div>');
185-
element.attr('id', 'crazy-man');
186-
var parent = jqLite('<div></div>');
187-
var parent2 = jqLite('<div></div>');
188-
$rootElement.append(parent);
189-
$rootElement.append(parent2);
190-
191-
expect(function() {
192-
$animate.enter(element, parent, parent2, invalidCallback);
193-
}).toThrowMinErr('$animate', 'nocb', 'Do not pass a callback to animate methods');
194-
195-
expect(function() {
196-
$animate.move(element, parent, parent2, invalidCallback);
197-
}).toThrowMinErr('$animate', 'nocb', 'Do not pass a callback to animate methods');
198-
199-
parent.append(element);
200-
201-
expect(function() {
202-
$animate.addClass(element, 'klass', invalidCallback);
203-
}).toThrowMinErr('$animate', 'nocb', 'Do not pass a callback to animate methods');
204-
205-
element.className = 'klass';
206-
expect(function() {
207-
$animate.removeClass(element, 'klass', invalidCallback);
208-
}).toThrowMinErr('$animate', 'nocb', 'Do not pass a callback to animate methods');
209-
210-
expect(function() {
211-
$animate.setClass(element, 'one', 'two', invalidCallback);
212-
}).toThrowMinErr('$animate', 'nocb', 'Do not pass a callback to animate methods');
213-
214-
expect(function() {
215-
$animate.leave(element, invalidCallback);
216-
}).toThrowMinErr('$animate', 'nocb', 'Do not pass a callback to animate methods');
217-
}));
218-
219180
describe('CSS class DOM manipulation', function() {
220181
var element;
221182
var addClass;

test/ngAnimate/animateSpec.js

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2817,44 +2817,6 @@ describe("ngAnimate", function() {
28172817
});
28182818

28192819
describe("options", function() {
2820-
it('should throw an error when a callback function is passed as the options param',
2821-
inject(function($animate, $rootScope, $document, $rootElement) {
2822-
2823-
var invalidCallback = function() { };
2824-
var element = jqLite('<div></div>');
2825-
element.attr('id', 'crazy-man');
2826-
var parent = jqLite('<div></div>');
2827-
var parent2 = jqLite('<div></div>');
2828-
$rootElement.append(parent);
2829-
$rootElement.append(parent2);
2830-
2831-
expect(function() {
2832-
$animate.enter(element, parent, parent2, invalidCallback);
2833-
}).toThrowMinErr('$animate', 'nocb', 'Do not pass a callback to animate methods');
2834-
2835-
expect(function() {
2836-
$animate.move(element, parent, parent2, invalidCallback);
2837-
}).toThrowMinErr('$animate', 'nocb', 'Do not pass a callback to animate methods');
2838-
2839-
parent.append(element);
2840-
2841-
expect(function() {
2842-
$animate.addClass(element, 'klass', invalidCallback);
2843-
}).toThrowMinErr('$animate', 'nocb', 'Do not pass a callback to animate methods');
2844-
2845-
element.className = 'klass';
2846-
expect(function() {
2847-
$animate.removeClass(element, 'klass', invalidCallback);
2848-
}).toThrowMinErr('$animate', 'nocb', 'Do not pass a callback to animate methods');
2849-
2850-
expect(function() {
2851-
$animate.setClass(element, 'one', 'two', invalidCallback);
2852-
}).toThrowMinErr('$animate', 'nocb', 'Do not pass a callback to animate methods');
2853-
2854-
expect(function() {
2855-
$animate.leave(element, invalidCallback);
2856-
}).toThrowMinErr('$animate', 'nocb', 'Do not pass a callback to animate methods');
2857-
}));
28582820

28592821
it('should add and remove the temporary className value is provided', function() {
28602822
var captures = {};

0 commit comments

Comments
 (0)