aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatias Niemelä2014-01-22 19:28:42 -0500
committerMatias Niemelä2014-02-06 01:22:14 -0500
commit4224cd5182bc93e4a210f75e0a4e4de7f3c544e8 (patch)
treef5fac86882816fc273975118b6f262f089436d3b /src
parent906fdad0f95465842e336e057ea97d0633712189 (diff)
downloadangular.js-4224cd5182bc93e4a210f75e0a4e4de7f3c544e8.tar.bz2
fix(mocks): rename mock.animate to ngAnimateMock and ensure it contains all test helper code for ngAnimate
Closes #5822 Closes #5917
Diffstat (limited to 'src')
-rw-r--r--src/ngMock/angular-mocks.js40
1 files changed, 13 insertions, 27 deletions
diff --git a/src/ngMock/angular-mocks.js b/src/ngMock/angular-mocks.js
index 091a8a16..1be07a24 100644
--- a/src/ngMock/angular-mocks.js
+++ b/src/ngMock/angular-mocks.js
@@ -757,43 +757,29 @@ angular.mock.TzDate = function (offset, timestamp) {
angular.mock.TzDate.prototype = Date.prototype;
/* jshint +W101 */
-// TODO(matias): remove this IMMEDIATELY once we can properly detect the
-// presence of a registered module
-var animateLoaded;
-try {
- angular.module('ngAnimate');
- animateLoaded = true;
-} catch(e) {}
-
-if(animateLoaded) {
- angular.module('ngAnimate').config(['$provide', function($provide) {
+angular.mock.animate = angular.module('ngAnimateMock', ['ng'])
+
+ .config(['$provide', function($provide) {
var reflowQueue = [];
+
$provide.value('$$animateReflow', function(fn) {
reflowQueue.push(fn);
return angular.noop;
});
- $provide.decorator('$animate', function($delegate) {
- $delegate.triggerReflow = function() {
- if(reflowQueue.length === 0) {
- throw new Error('No animation reflows present');
- }
- angular.forEach(reflowQueue, function(fn) {
- fn();
- });
- reflowQueue = [];
- };
- return $delegate;
- });
- }]);
-}
-angular.mock.animate = angular.module('mock.animate', ['ng'])
-
- .config(['$provide', function($provide) {
$provide.decorator('$animate', function($delegate) {
var animate = {
queue : [],
enabled : $delegate.enabled,
+ triggerReflow : function() {
+ if(reflowQueue.length === 0) {
+ throw new Error('No animation reflows present');
+ }
+ angular.forEach(reflowQueue, function(fn) {
+ fn();
+ });
+ reflowQueue = [];
+ }
};
angular.forEach(['enter','leave','move','addClass','removeClass'], function(method) {