aboutsummaryrefslogtreecommitdiffstats
path: root/src/ngMock
diff options
context:
space:
mode:
Diffstat (limited to 'src/ngMock')
-rw-r--r--src/ngMock/angular-mocks.js37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/ngMock/angular-mocks.js b/src/ngMock/angular-mocks.js
index e05e7a28..bfb601fd 100644
--- a/src/ngMock/angular-mocks.js
+++ b/src/ngMock/angular-mocks.js
@@ -627,6 +627,43 @@ angular.mock.$LogProvider = function() {
angular.mock.TzDate.prototype = Date.prototype;
})();
+angular.mock.animate = angular.module('mock.animate', ['ng'])
+
+ .config(['$provide', function($provide) {
+
+ $provide.decorator('$animate', function($delegate) {
+ var animate = {
+ queue : [],
+ enabled : $delegate.enabled,
+ process : function(name) {
+ var tick = animate.queue.shift();
+ expect(tick.method).toBe(name);
+ tick.fn();
+ return tick;
+ }
+ };
+
+ forEach(['enter','leave','move','show','hide','addClass','removeClass'], function(method) {
+ animate[method] = function() {
+ var params = arguments;
+ animate.queue.push({
+ method : method,
+ params : params,
+ element : angular.isElement(params[0]) && params[0],
+ parent : angular.isElement(params[1]) && params[1],
+ after : angular.isElement(params[2]) && params[2],
+ fn : function() {
+ $delegate[method].apply($delegate, params);
+ }
+ });
+ };
+ });
+
+ return animate;
+ });
+
+ }]);
+
/**
* @ngdoc function
* @name angular.mock.createMockWindow