public/browse/lib/angular-mocks/angular-mocks.js
File angular-mocks.js
has 946 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/**
* @license AngularJS v1.3.5
* (c) 2010-2014 Google, Inc. http://angularjs.org
* License: MIT
*/
Function createHttpBackendMock
has 147 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function createHttpBackendMock($rootScope, $delegate, $browser) {
var definitions = [],
expectations = [],
responses = [],
responsesPush = angular.bind(responses, responses.push),
Function TzDate
has 93 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
angular.mock.TzDate = function(offset, timestamp) {
var self = new Date(0);
if (angular.isString(timestamp)) {
var tsStr = timestamp;
Function $IntervalProvider
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
angular.mock.$IntervalProvider = function() {
this.$get = ['$browser', '$rootScope', '$q', '$$q',
function($browser, $rootScope, $q, $$q) {
var repeatFns = [],
nextRepeatId = 0,
Function $get
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function($browser, $rootScope, $q, $$q) {
var repeatFns = [],
nextRepeatId = 0,
now = 0;
Function $Browser
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
angular.mock.$Browser = function() {
var self = this;
this.isMock = true;
self.$$url = "http://server/";
Function $httpBackend
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function $httpBackend(method, url, data, callback, headers, timeout, withCredentials) {
var xhr = new MockXhr(),
expectation = expectations[0],
wasExpected = false;
Function $LogProvider
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
angular.mock.$LogProvider = function() {
var debug = true;
function concat(array1, array2, index) {
return array1.concat(Array.prototype.slice.call(array2, index));
Function dump
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
angular.mock.dump = function(object) {
return serialize(object);
function serialize(object) {
var out;
Function animate
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
.config(['$provide', function($provide) {
var reflowQueue = [];
$provide.value('$$animateReflow', function(fn) {
var index = reflowQueue.length;
Function $get
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
this.$get = function() {
var $log = {
log: function() { $log.log.logs.push(concat([], arguments, 0)); },
warn: function() { $log.warn.logs.push(concat([], arguments, 0)); },
info: function() { $log.info.logs.push(concat([], arguments, 0)); },
Function inject
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
window.inject = angular.mock.inject = function() {
var blockFns = Array.prototype.slice.call(arguments, 0);
var errorForStack = new Error('Declaration Location');
return isSpecRunning() ? workFn.call(currentSpec) : workFn;
/////////////////////
Function $interval
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var $interval = function(fn, delay, count, invokeApply) {
var iteration = 0,
skipApply = (angular.isDefined(invokeApply) && !invokeApply),
deferred = (skipApply ? $$q : $q).defer(),
promise = deferred.promise;
Function MockXhr
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function MockXhr() {
// hack for testing $http, $httpBackend
MockXhr.$$lastInstance = this;
Function $RootScopeDecorator
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
angular.mock.$RootScopeDecorator = ['$delegate', function($delegate) {
var $rootScopePrototype = Object.getPrototypeOf($delegate);
$rootScopePrototype.$countChildScopes = countChildScopes;
Function MockHttpExpectation
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function MockHttpExpectation(method, url, data, headers) {
this.data = data;
this.headers = headers;
Function workFn
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function workFn() {
var modules = currentSpec.$modules || [];
var strictDi = !!currentSpec.$injectorStrict;
modules.unshift('ngMock');
modules.unshift('ng');
Function $ExceptionHandlerProvider
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
angular.mock.$ExceptionHandlerProvider = function() {
var handler;
/**
* @ngdoc method
Function serialize
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function serialize(object) {
var out;
if (angular.isElement(object)) {
object = angular.element(object);
Function $httpBackend
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function $httpBackend(method, url, data, callback, headers, timeout, withCredentials) {
Consider simplifying this complex logical expression. Open
Open
if (window.jasmine || window.mocha) {
var currentSpec = null,
isSpecRunning = function() {
return !!currentSpec;
Avoid too many return
statements within this function. Open
Open
return true;
Avoid too many return
statements within this function. Open
Open
return data == d;