
toserve.fobo.angular-material.1.0.1.js.angular-material-mocks.js Maven / Gradle / Ivy
The newest version!
/**
*
* Angular-Material-Mocks
*
* Developers interested in running their own custom unit tests WITH angular-material.js loaded...
* must also include this *mocks* file. Similar to `angular-mocks.js`, `angular-material-mocks.js`
* will override and disable specific Angular Material performance settings:
*
* - Disabled Theme CSS rule generations
* - Forces $mdAria.expectWithText() to be synchronous
* - Mocks $$rAF.throttle()
* - Captures flush exceptions from $$rAF
*
*/
(function(window, angular, undefined) {
'use strict';
/**
* @ngdoc module
* @name ngMaterial-mock
* @packageName angular-material-mocks
*
* @description
*
* The `ngMaterial-mock` module provides support
*
*/
angular.module('ngMaterial-mock', [
'ngMock',
'ngAnimateMock',
'material.core'
])
.config(['$provide', function($provide) {
$provide.factory('$material', ['$animate', '$timeout', function($animate, $timeout) {
return {
flushOutstandingAnimations: function() {
// this code is placed in a try-catch statement
// since 1.3 and 1.4 handle their animations differently
// and there may be situations where follow-up animations
// are run in one version and not the other
try { $animate.flush(); } catch(e) {}
},
flushInterimElement: function() {
this.flushOutstandingAnimations();
$timeout.flush();
this.flushOutstandingAnimations();
$timeout.flush();
this.flushOutstandingAnimations();
$timeout.flush();
}
};
}]);
/**
* Angular Material dynamically generates Style tags
* based on themes and palletes; for each ng-app.
*
* For testing, we want to disable generation and
*