mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-23 21:35:47 +00:00
fix(ngMock): ensure ngAnimate isn't a required mock
This commit is contained in:
parent
7d09bd30f9
commit
1413328e6a
1 changed files with 29 additions and 19 deletions
48
src/ngMock/angular-mocks.js
vendored
48
src/ngMock/angular-mocks.js
vendored
|
|
@ -756,25 +756,35 @@ angular.mock.TzDate = function (offset, timestamp) {
|
||||||
angular.mock.TzDate.prototype = Date.prototype;
|
angular.mock.TzDate.prototype = Date.prototype;
|
||||||
/* jshint +W101 */
|
/* jshint +W101 */
|
||||||
|
|
||||||
angular.module('ngAnimate').config(['$provide', function($provide) {
|
// TODO(matias): remove this IMMEDIATELY once we can properly detect the
|
||||||
var reflowQueue = [];
|
// presence of a registered module
|
||||||
$provide.value('$$animateReflow', function(fn) {
|
var animateLoaded;
|
||||||
reflowQueue.push(fn);
|
try {
|
||||||
return angular.noop;
|
angular.module('ngAnimate');
|
||||||
});
|
animateLoaded = true;
|
||||||
$provide.decorator('$animate', function($delegate) {
|
} catch(e) {}
|
||||||
$delegate.triggerReflow = function() {
|
|
||||||
if(reflowQueue.length === 0) {
|
if(animateLoaded) {
|
||||||
throw new Error('No animation reflows present');
|
angular.module('ngAnimate').config(['$provide', function($provide) {
|
||||||
}
|
var reflowQueue = [];
|
||||||
angular.forEach(reflowQueue, function(fn) {
|
$provide.value('$$animateReflow', function(fn) {
|
||||||
fn();
|
reflowQueue.push(fn);
|
||||||
});
|
return angular.noop;
|
||||||
reflowQueue = [];
|
});
|
||||||
};
|
$provide.decorator('$animate', function($delegate) {
|
||||||
return $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'])
|
angular.mock.animate = angular.module('mock.animate', ['ng'])
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue