angular-gem 1.2.13 → 1.2.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/angular-gem/version.rb +1 -1
- data/vendor/assets/javascripts/1.2.14/angular-animate.js +1614 -0
- data/vendor/assets/javascripts/1.2.14/angular-cookies.js +197 -0
- data/vendor/assets/javascripts/1.2.14/angular-loader.js +414 -0
- data/vendor/assets/javascripts/1.2.14/angular-mocks.js +2160 -0
- data/vendor/assets/javascripts/1.2.14/angular-resource.js +597 -0
- data/vendor/assets/javascripts/1.2.14/angular-route.js +922 -0
- data/vendor/assets/javascripts/1.2.14/angular-sanitize.js +624 -0
- data/vendor/assets/javascripts/1.2.14/angular-scenario.js +33059 -0
- data/vendor/assets/javascripts/1.2.14/angular-touch.js +561 -0
- data/vendor/assets/javascripts/1.2.14/angular.js +21053 -0
- data/vendor/assets/javascripts/angular-animate.js +286 -261
- data/vendor/assets/javascripts/angular-cookies.js +14 -19
- data/vendor/assets/javascripts/angular-loader.js +33 -29
- data/vendor/assets/javascripts/angular-mocks.js +163 -139
- data/vendor/assets/javascripts/angular-resource.js +34 -33
- data/vendor/assets/javascripts/angular-route.js +55 -54
- data/vendor/assets/javascripts/angular-sanitize.js +17 -18
- data/vendor/assets/javascripts/angular-scenario.js +1647 -1468
- data/vendor/assets/javascripts/angular-touch.js +21 -23
- data/vendor/assets/javascripts/angular.js +1646 -1467
- metadata +12 -2
@@ -1,20 +1,19 @@
|
|
1
1
|
/**
|
2
|
-
* @license AngularJS v1.2.
|
2
|
+
* @license AngularJS v1.2.14
|
3
3
|
* (c) 2010-2014 Google, Inc. http://angularjs.org
|
4
4
|
* License: MIT
|
5
5
|
*/
|
6
6
|
(function(window, angular, undefined) {'use strict';
|
7
7
|
|
8
8
|
/**
|
9
|
-
* @ngdoc
|
9
|
+
* @ngdoc module
|
10
10
|
* @name ngCookies
|
11
11
|
* @description
|
12
12
|
*
|
13
13
|
* # ngCookies
|
14
14
|
*
|
15
|
-
* The `ngCookies` module provides a convenient wrapper for reading and writing browser cookies.
|
15
|
+
* The `ngCookies` module provides a convenient wrapper for reading and writing browser cookies.
|
16
16
|
*
|
17
|
-
* {@installModule cookies}
|
18
17
|
*
|
19
18
|
* <div doc-module-components="ngCookies"></div>
|
20
19
|
*
|
@@ -25,9 +24,8 @@
|
|
25
24
|
|
26
25
|
angular.module('ngCookies', ['ng']).
|
27
26
|
/**
|
28
|
-
* @ngdoc
|
29
|
-
* @name
|
30
|
-
* @requires $browser
|
27
|
+
* @ngdoc service
|
28
|
+
* @name $cookies
|
31
29
|
*
|
32
30
|
* @description
|
33
31
|
* Provides read/write access to browser's cookies.
|
@@ -38,8 +36,8 @@ angular.module('ngCookies', ['ng']).
|
|
38
36
|
* Requires the {@link ngCookies `ngCookies`} module to be installed.
|
39
37
|
*
|
40
38
|
* @example
|
41
|
-
<
|
42
|
-
<
|
39
|
+
<example>
|
40
|
+
<file name="index.html">
|
43
41
|
<script>
|
44
42
|
function ExampleController($cookies) {
|
45
43
|
// Retrieving a cookie
|
@@ -48,8 +46,8 @@ angular.module('ngCookies', ['ng']).
|
|
48
46
|
$cookies.myFavorite = 'oatmeal';
|
49
47
|
}
|
50
48
|
</script>
|
51
|
-
</
|
52
|
-
</
|
49
|
+
</file>
|
50
|
+
</example>
|
53
51
|
*/
|
54
52
|
factory('$cookies', ['$rootScope', '$browser', function ($rootScope, $browser) {
|
55
53
|
var cookies = {},
|
@@ -134,8 +132,8 @@ angular.module('ngCookies', ['ng']).
|
|
134
132
|
|
135
133
|
|
136
134
|
/**
|
137
|
-
* @ngdoc
|
138
|
-
* @name
|
135
|
+
* @ngdoc service
|
136
|
+
* @name $cookieStore
|
139
137
|
* @requires $cookies
|
140
138
|
*
|
141
139
|
* @description
|
@@ -152,8 +150,7 @@ angular.module('ngCookies', ['ng']).
|
|
152
150
|
return {
|
153
151
|
/**
|
154
152
|
* @ngdoc method
|
155
|
-
* @name
|
156
|
-
* @methodOf ngCookies.$cookieStore
|
153
|
+
* @name $cookieStore#get
|
157
154
|
*
|
158
155
|
* @description
|
159
156
|
* Returns the value of given cookie key
|
@@ -168,8 +165,7 @@ angular.module('ngCookies', ['ng']).
|
|
168
165
|
|
169
166
|
/**
|
170
167
|
* @ngdoc method
|
171
|
-
* @name
|
172
|
-
* @methodOf ngCookies.$cookieStore
|
168
|
+
* @name $cookieStore#put
|
173
169
|
*
|
174
170
|
* @description
|
175
171
|
* Sets a value for given cookie key
|
@@ -183,8 +179,7 @@ angular.module('ngCookies', ['ng']).
|
|
183
179
|
|
184
180
|
/**
|
185
181
|
* @ngdoc method
|
186
|
-
* @name
|
187
|
-
* @methodOf ngCookies.$cookieStore
|
182
|
+
* @name $cookieStore#remove
|
188
183
|
*
|
189
184
|
* @description
|
190
185
|
* Remove given cookie
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license AngularJS v1.2.
|
2
|
+
* @license AngularJS v1.2.14
|
3
3
|
* (c) 2010-2014 Google, Inc. http://angularjs.org
|
4
4
|
* License: MIT
|
5
5
|
*/
|
@@ -31,7 +31,7 @@
|
|
31
31
|
* should all be static strings, not variables or general expressions.
|
32
32
|
*
|
33
33
|
* @param {string} module The namespace to use for the new minErr instance.
|
34
|
-
* @returns {function(string, string, ...): Error} instance
|
34
|
+
* @returns {function(code:string, template:string, ...templateArgs): Error} minErr instance
|
35
35
|
*/
|
36
36
|
|
37
37
|
function minErr(module) {
|
@@ -69,7 +69,7 @@ function minErr(module) {
|
|
69
69
|
return match;
|
70
70
|
});
|
71
71
|
|
72
|
-
message = message + '\nhttp://errors.angularjs.org/1.2.
|
72
|
+
message = message + '\nhttp://errors.angularjs.org/1.2.14/' +
|
73
73
|
(module ? module + '/' : '') + code;
|
74
74
|
for (i = 2; i < arguments.length; i++) {
|
75
75
|
message = message + (i == 2 ? '?' : '&') + 'p' + (i-2) + '=' +
|
@@ -81,8 +81,9 @@ function minErr(module) {
|
|
81
81
|
}
|
82
82
|
|
83
83
|
/**
|
84
|
-
* @ngdoc
|
84
|
+
* @ngdoc type
|
85
85
|
* @name angular.Module
|
86
|
+
* @module ng
|
86
87
|
* @description
|
87
88
|
*
|
88
89
|
* Interface for configuring angular {@link angular.module modules}.
|
@@ -109,6 +110,7 @@ function setupModuleLoader(window) {
|
|
109
110
|
/**
|
110
111
|
* @ngdoc function
|
111
112
|
* @name angular.module
|
113
|
+
* @module ng
|
112
114
|
* @description
|
113
115
|
*
|
114
116
|
* The `angular.module` is a global place for creating, registering and retrieving Angular
|
@@ -123,9 +125,9 @@ function setupModuleLoader(window) {
|
|
123
125
|
* # Module
|
124
126
|
*
|
125
127
|
* A module is a collection of services, directives, filters, and configuration information.
|
126
|
-
* `angular.module` is used to configure the {@link
|
128
|
+
* `angular.module` is used to configure the {@link auto.$injector $injector}.
|
127
129
|
*
|
128
|
-
*
|
130
|
+
* ```js
|
129
131
|
* // Create a new module
|
130
132
|
* var myModule = angular.module('myModule', []);
|
131
133
|
*
|
@@ -137,13 +139,13 @@ function setupModuleLoader(window) {
|
|
137
139
|
* // Configure existing providers
|
138
140
|
* $locationProvider.hashPrefix('!');
|
139
141
|
* });
|
140
|
-
*
|
142
|
+
* ```
|
141
143
|
*
|
142
144
|
* Then you can create an injector and load your modules like this:
|
143
145
|
*
|
144
|
-
*
|
146
|
+
* ```js
|
145
147
|
* var injector = angular.injector(['ng', 'MyModule'])
|
146
|
-
*
|
148
|
+
* ```
|
147
149
|
*
|
148
150
|
* However it's more likely that you'll just use
|
149
151
|
* {@link ng.directive:ngApp ngApp} or
|
@@ -153,7 +155,7 @@ function setupModuleLoader(window) {
|
|
153
155
|
* @param {Array.<string>=} requires If specified then new module is being created. If
|
154
156
|
* unspecified then the the module is being retrieved for further configuration.
|
155
157
|
* @param {Function} configFn Optional configuration function for the module. Same as
|
156
|
-
* {@link angular.Module#
|
158
|
+
* {@link angular.Module#config Module#config()}.
|
157
159
|
* @returns {module} new module with the {@link angular.Module} api.
|
158
160
|
*/
|
159
161
|
return function module(name, requires, configFn) {
|
@@ -191,6 +193,7 @@ function setupModuleLoader(window) {
|
|
191
193
|
/**
|
192
194
|
* @ngdoc property
|
193
195
|
* @name angular.Module#requires
|
196
|
+
* @module ng
|
194
197
|
* @propertyOf angular.Module
|
195
198
|
* @returns {Array.<string>} List of module names which must be loaded before this module.
|
196
199
|
* @description
|
@@ -202,6 +205,7 @@ function setupModuleLoader(window) {
|
|
202
205
|
/**
|
203
206
|
* @ngdoc property
|
204
207
|
* @name angular.Module#name
|
208
|
+
* @module ng
|
205
209
|
* @propertyOf angular.Module
|
206
210
|
* @returns {string} Name of the module.
|
207
211
|
* @description
|
@@ -212,64 +216,64 @@ function setupModuleLoader(window) {
|
|
212
216
|
/**
|
213
217
|
* @ngdoc method
|
214
218
|
* @name angular.Module#provider
|
215
|
-
* @
|
219
|
+
* @module ng
|
216
220
|
* @param {string} name service name
|
217
221
|
* @param {Function} providerType Construction function for creating new instance of the
|
218
222
|
* service.
|
219
223
|
* @description
|
220
|
-
* See {@link
|
224
|
+
* See {@link auto.$provide#provider $provide.provider()}.
|
221
225
|
*/
|
222
226
|
provider: invokeLater('$provide', 'provider'),
|
223
227
|
|
224
228
|
/**
|
225
229
|
* @ngdoc method
|
226
230
|
* @name angular.Module#factory
|
227
|
-
* @
|
231
|
+
* @module ng
|
228
232
|
* @param {string} name service name
|
229
233
|
* @param {Function} providerFunction Function for creating new instance of the service.
|
230
234
|
* @description
|
231
|
-
* See {@link
|
235
|
+
* See {@link auto.$provide#factory $provide.factory()}.
|
232
236
|
*/
|
233
237
|
factory: invokeLater('$provide', 'factory'),
|
234
238
|
|
235
239
|
/**
|
236
240
|
* @ngdoc method
|
237
241
|
* @name angular.Module#service
|
238
|
-
* @
|
242
|
+
* @module ng
|
239
243
|
* @param {string} name service name
|
240
244
|
* @param {Function} constructor A constructor function that will be instantiated.
|
241
245
|
* @description
|
242
|
-
* See {@link
|
246
|
+
* See {@link auto.$provide#service $provide.service()}.
|
243
247
|
*/
|
244
248
|
service: invokeLater('$provide', 'service'),
|
245
249
|
|
246
250
|
/**
|
247
251
|
* @ngdoc method
|
248
252
|
* @name angular.Module#value
|
249
|
-
* @
|
253
|
+
* @module ng
|
250
254
|
* @param {string} name service name
|
251
255
|
* @param {*} object Service instance object.
|
252
256
|
* @description
|
253
|
-
* See {@link
|
257
|
+
* See {@link auto.$provide#value $provide.value()}.
|
254
258
|
*/
|
255
259
|
value: invokeLater('$provide', 'value'),
|
256
260
|
|
257
261
|
/**
|
258
262
|
* @ngdoc method
|
259
263
|
* @name angular.Module#constant
|
260
|
-
* @
|
264
|
+
* @module ng
|
261
265
|
* @param {string} name constant name
|
262
266
|
* @param {*} object Constant value.
|
263
267
|
* @description
|
264
268
|
* Because the constant are fixed, they get applied before other provide methods.
|
265
|
-
* See {@link
|
269
|
+
* See {@link auto.$provide#constant $provide.constant()}.
|
266
270
|
*/
|
267
271
|
constant: invokeLater('$provide', 'constant', 'unshift'),
|
268
272
|
|
269
273
|
/**
|
270
274
|
* @ngdoc method
|
271
275
|
* @name angular.Module#animation
|
272
|
-
* @
|
276
|
+
* @module ng
|
273
277
|
* @param {string} name animation name
|
274
278
|
* @param {Function} animationFactory Factory function for creating new instance of an
|
275
279
|
* animation.
|
@@ -281,7 +285,7 @@ function setupModuleLoader(window) {
|
|
281
285
|
* Defines an animation hook that can be later used with
|
282
286
|
* {@link ngAnimate.$animate $animate} service and directives that use this service.
|
283
287
|
*
|
284
|
-
*
|
288
|
+
* ```js
|
285
289
|
* module.animation('.animation-name', function($inject1, $inject2) {
|
286
290
|
* return {
|
287
291
|
* eventName : function(element, done) {
|
@@ -293,7 +297,7 @@ function setupModuleLoader(window) {
|
|
293
297
|
* }
|
294
298
|
* }
|
295
299
|
* })
|
296
|
-
*
|
300
|
+
* ```
|
297
301
|
*
|
298
302
|
* See {@link ngAnimate.$animateProvider#register $animateProvider.register()} and
|
299
303
|
* {@link ngAnimate ngAnimate module} for more information.
|
@@ -303,7 +307,7 @@ function setupModuleLoader(window) {
|
|
303
307
|
/**
|
304
308
|
* @ngdoc method
|
305
309
|
* @name angular.Module#filter
|
306
|
-
* @
|
310
|
+
* @module ng
|
307
311
|
* @param {string} name Filter name.
|
308
312
|
* @param {Function} filterFactory Factory function for creating new instance of filter.
|
309
313
|
* @description
|
@@ -314,7 +318,7 @@ function setupModuleLoader(window) {
|
|
314
318
|
/**
|
315
319
|
* @ngdoc method
|
316
320
|
* @name angular.Module#controller
|
317
|
-
* @
|
321
|
+
* @module ng
|
318
322
|
* @param {string|Object} name Controller name, or an object map of controllers where the
|
319
323
|
* keys are the names and the values are the constructors.
|
320
324
|
* @param {Function} constructor Controller constructor function.
|
@@ -326,20 +330,20 @@ function setupModuleLoader(window) {
|
|
326
330
|
/**
|
327
331
|
* @ngdoc method
|
328
332
|
* @name angular.Module#directive
|
329
|
-
* @
|
333
|
+
* @module ng
|
330
334
|
* @param {string|Object} name Directive name, or an object map of directives where the
|
331
335
|
* keys are the names and the values are the factories.
|
332
336
|
* @param {Function} directiveFactory Factory function for creating new instance of
|
333
337
|
* directives.
|
334
338
|
* @description
|
335
|
-
* See {@link ng.$compileProvider#
|
339
|
+
* See {@link ng.$compileProvider#directive $compileProvider.directive()}.
|
336
340
|
*/
|
337
341
|
directive: invokeLater('$compileProvider', 'directive'),
|
338
342
|
|
339
343
|
/**
|
340
344
|
* @ngdoc method
|
341
345
|
* @name angular.Module#config
|
342
|
-
* @
|
346
|
+
* @module ng
|
343
347
|
* @param {Function} configFn Execute this function on module load. Useful for service
|
344
348
|
* configuration.
|
345
349
|
* @description
|
@@ -350,7 +354,7 @@ function setupModuleLoader(window) {
|
|
350
354
|
/**
|
351
355
|
* @ngdoc method
|
352
356
|
* @name angular.Module#run
|
353
|
-
* @
|
357
|
+
* @module ng
|
354
358
|
* @param {Function} initializationFn Execute this function after injector creation.
|
355
359
|
* Useful for application initialization.
|
356
360
|
* @description
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license AngularJS v1.2.
|
2
|
+
* @license AngularJS v1.2.14
|
3
3
|
* (c) 2010-2014 Google, Inc. http://angularjs.org
|
4
4
|
* License: MIT
|
5
5
|
*/
|
@@ -8,7 +8,7 @@
|
|
8
8
|
'use strict';
|
9
9
|
|
10
10
|
/**
|
11
|
-
* @ngdoc
|
11
|
+
* @ngdoc object
|
12
12
|
* @name angular.mock
|
13
13
|
* @description
|
14
14
|
*
|
@@ -19,7 +19,7 @@ angular.mock = {};
|
|
19
19
|
/**
|
20
20
|
* ! This is a private undocumented service !
|
21
21
|
*
|
22
|
-
* @name
|
22
|
+
* @name $browser
|
23
23
|
*
|
24
24
|
* @description
|
25
25
|
* This service is a mock implementation of {@link ng.$browser}. It provides fake
|
@@ -77,8 +77,7 @@ angular.mock.$Browser = function() {
|
|
77
77
|
|
78
78
|
|
79
79
|
/**
|
80
|
-
* @name
|
81
|
-
* @propertyOf ngMock.$browser
|
80
|
+
* @name $browser#defer.now
|
82
81
|
*
|
83
82
|
* @description
|
84
83
|
* Current milliseconds mock time.
|
@@ -103,8 +102,7 @@ angular.mock.$Browser = function() {
|
|
103
102
|
|
104
103
|
|
105
104
|
/**
|
106
|
-
* @name
|
107
|
-
* @methodOf ngMock.$browser
|
105
|
+
* @name $browser#defer.flush
|
108
106
|
*
|
109
107
|
* @description
|
110
108
|
* Flushes all pending requests and executes the defer callbacks.
|
@@ -135,8 +133,7 @@ angular.mock.$Browser = function() {
|
|
135
133
|
angular.mock.$Browser.prototype = {
|
136
134
|
|
137
135
|
/**
|
138
|
-
* @name
|
139
|
-
* @methodOf ngMock.$browser
|
136
|
+
* @name $browser#poll
|
140
137
|
*
|
141
138
|
* @description
|
142
139
|
* run all fns in pollFns
|
@@ -187,8 +184,8 @@ angular.mock.$Browser.prototype = {
|
|
187
184
|
|
188
185
|
|
189
186
|
/**
|
190
|
-
* @ngdoc
|
191
|
-
* @name
|
187
|
+
* @ngdoc provider
|
188
|
+
* @name $exceptionHandlerProvider
|
192
189
|
*
|
193
190
|
* @description
|
194
191
|
* Configures the mock implementation of {@link ng.$exceptionHandler} to rethrow or to log errors
|
@@ -196,8 +193,8 @@ angular.mock.$Browser.prototype = {
|
|
196
193
|
*/
|
197
194
|
|
198
195
|
/**
|
199
|
-
* @ngdoc
|
200
|
-
* @name
|
196
|
+
* @ngdoc service
|
197
|
+
* @name $exceptionHandler
|
201
198
|
*
|
202
199
|
* @description
|
203
200
|
* Mock implementation of {@link ng.$exceptionHandler} that rethrows or logs errors passed
|
@@ -205,7 +202,7 @@ angular.mock.$Browser.prototype = {
|
|
205
202
|
* information.
|
206
203
|
*
|
207
204
|
*
|
208
|
-
*
|
205
|
+
* ```js
|
209
206
|
* describe('$exceptionHandlerProvider', function() {
|
210
207
|
*
|
211
208
|
* it('should capture log messages and exceptions', function() {
|
@@ -226,7 +223,7 @@ angular.mock.$Browser.prototype = {
|
|
226
223
|
* });
|
227
224
|
* });
|
228
225
|
* });
|
229
|
-
*
|
226
|
+
* ```
|
230
227
|
*/
|
231
228
|
|
232
229
|
angular.mock.$ExceptionHandlerProvider = function() {
|
@@ -234,8 +231,7 @@ angular.mock.$ExceptionHandlerProvider = function() {
|
|
234
231
|
|
235
232
|
/**
|
236
233
|
* @ngdoc method
|
237
|
-
* @name
|
238
|
-
* @methodOf ngMock.$exceptionHandlerProvider
|
234
|
+
* @name $exceptionHandlerProvider#mode
|
239
235
|
*
|
240
236
|
* @description
|
241
237
|
* Sets the logging mode.
|
@@ -285,7 +281,7 @@ angular.mock.$ExceptionHandlerProvider = function() {
|
|
285
281
|
|
286
282
|
/**
|
287
283
|
* @ngdoc service
|
288
|
-
* @name
|
284
|
+
* @name $log
|
289
285
|
*
|
290
286
|
* @description
|
291
287
|
* Mock implementation of {@link ng.$log} that gathers all logged messages in arrays
|
@@ -324,8 +320,7 @@ angular.mock.$LogProvider = function() {
|
|
324
320
|
|
325
321
|
/**
|
326
322
|
* @ngdoc method
|
327
|
-
* @name
|
328
|
-
* @methodOf ngMock.$log
|
323
|
+
* @name $log#reset
|
329
324
|
*
|
330
325
|
* @description
|
331
326
|
* Reset all of the logging arrays to empty.
|
@@ -333,85 +328,79 @@ angular.mock.$LogProvider = function() {
|
|
333
328
|
$log.reset = function () {
|
334
329
|
/**
|
335
330
|
* @ngdoc property
|
336
|
-
* @name
|
337
|
-
* @propertyOf ngMock.$log
|
331
|
+
* @name $log#log.logs
|
338
332
|
*
|
339
333
|
* @description
|
340
334
|
* Array of messages logged using {@link ngMock.$log#log}.
|
341
335
|
*
|
342
336
|
* @example
|
343
|
-
*
|
337
|
+
* ```js
|
344
338
|
* $log.log('Some Log');
|
345
339
|
* var first = $log.log.logs.unshift();
|
346
|
-
*
|
340
|
+
* ```
|
347
341
|
*/
|
348
342
|
$log.log.logs = [];
|
349
343
|
/**
|
350
344
|
* @ngdoc property
|
351
|
-
* @name
|
352
|
-
* @propertyOf ngMock.$log
|
345
|
+
* @name $log#info.logs
|
353
346
|
*
|
354
347
|
* @description
|
355
348
|
* Array of messages logged using {@link ngMock.$log#info}.
|
356
349
|
*
|
357
350
|
* @example
|
358
|
-
*
|
351
|
+
* ```js
|
359
352
|
* $log.info('Some Info');
|
360
353
|
* var first = $log.info.logs.unshift();
|
361
|
-
*
|
354
|
+
* ```
|
362
355
|
*/
|
363
356
|
$log.info.logs = [];
|
364
357
|
/**
|
365
358
|
* @ngdoc property
|
366
|
-
* @name
|
367
|
-
* @propertyOf ngMock.$log
|
359
|
+
* @name $log#warn.logs
|
368
360
|
*
|
369
361
|
* @description
|
370
362
|
* Array of messages logged using {@link ngMock.$log#warn}.
|
371
363
|
*
|
372
364
|
* @example
|
373
|
-
*
|
365
|
+
* ```js
|
374
366
|
* $log.warn('Some Warning');
|
375
367
|
* var first = $log.warn.logs.unshift();
|
376
|
-
*
|
368
|
+
* ```
|
377
369
|
*/
|
378
370
|
$log.warn.logs = [];
|
379
371
|
/**
|
380
372
|
* @ngdoc property
|
381
|
-
* @name
|
382
|
-
* @propertyOf ngMock.$log
|
373
|
+
* @name $log#error.logs
|
383
374
|
*
|
384
375
|
* @description
|
385
376
|
* Array of messages logged using {@link ngMock.$log#error}.
|
386
377
|
*
|
387
378
|
* @example
|
388
|
-
*
|
379
|
+
* ```js
|
389
380
|
* $log.error('Some Error');
|
390
381
|
* var first = $log.error.logs.unshift();
|
391
|
-
*
|
382
|
+
* ```
|
392
383
|
*/
|
393
384
|
$log.error.logs = [];
|
394
385
|
/**
|
395
386
|
* @ngdoc property
|
396
|
-
* @name
|
397
|
-
* @propertyOf ngMock.$log
|
387
|
+
* @name $log#debug.logs
|
398
388
|
*
|
399
389
|
* @description
|
400
390
|
* Array of messages logged using {@link ngMock.$log#debug}.
|
401
391
|
*
|
402
392
|
* @example
|
403
|
-
*
|
393
|
+
* ```js
|
404
394
|
* $log.debug('Some Error');
|
405
395
|
* var first = $log.debug.logs.unshift();
|
406
|
-
*
|
396
|
+
* ```
|
407
397
|
*/
|
408
398
|
$log.debug.logs = [];
|
409
399
|
};
|
410
400
|
|
411
401
|
/**
|
412
402
|
* @ngdoc method
|
413
|
-
* @name
|
414
|
-
* @methodOf ngMock.$log
|
403
|
+
* @name $log#assertEmpty
|
415
404
|
*
|
416
405
|
* @description
|
417
406
|
* Assert that the all of the logging methods have no logged messages. If messages present, an
|
@@ -443,12 +432,12 @@ angular.mock.$LogProvider = function() {
|
|
443
432
|
|
444
433
|
/**
|
445
434
|
* @ngdoc service
|
446
|
-
* @name
|
435
|
+
* @name $interval
|
447
436
|
*
|
448
437
|
* @description
|
449
438
|
* Mock implementation of the $interval service.
|
450
439
|
*
|
451
|
-
* Use {@link ngMock.$interval#
|
440
|
+
* Use {@link ngMock.$interval#flush `$interval.flush(millis)`} to
|
452
441
|
* move forward by `millis` milliseconds and trigger any functions scheduled to run in that
|
453
442
|
* time.
|
454
443
|
*
|
@@ -457,7 +446,7 @@ angular.mock.$LogProvider = function() {
|
|
457
446
|
* @param {number=} [count=0] Number of times to repeat. If not set, or 0, will repeat
|
458
447
|
* indefinitely.
|
459
448
|
* @param {boolean=} [invokeApply=true] If set to `false` skips model dirty checking, otherwise
|
460
|
-
* will invoke `fn` within the {@link ng.$rootScope.Scope
|
449
|
+
* will invoke `fn` within the {@link ng.$rootScope.Scope#$apply $apply} block.
|
461
450
|
* @returns {promise} A promise which will be notified on each iteration.
|
462
451
|
*/
|
463
452
|
angular.mock.$IntervalProvider = function() {
|
@@ -509,7 +498,16 @@ angular.mock.$IntervalProvider = function() {
|
|
509
498
|
nextRepeatId++;
|
510
499
|
return promise;
|
511
500
|
};
|
512
|
-
|
501
|
+
/**
|
502
|
+
* @ngdoc method
|
503
|
+
* @name $interval#cancel
|
504
|
+
*
|
505
|
+
* @description
|
506
|
+
* Cancels a task associated with the `promise`.
|
507
|
+
*
|
508
|
+
* @param {number} promise A promise from calling the `$interval` function.
|
509
|
+
* @returns {boolean} Returns `true` if the task was successfully cancelled.
|
510
|
+
*/
|
513
511
|
$interval.cancel = function(promise) {
|
514
512
|
if(!promise) return false;
|
515
513
|
var fnIndex;
|
@@ -529,8 +527,7 @@ angular.mock.$IntervalProvider = function() {
|
|
529
527
|
|
530
528
|
/**
|
531
529
|
* @ngdoc method
|
532
|
-
* @name
|
533
|
-
* @methodOf ngMock.$interval
|
530
|
+
* @name $interval#flush
|
534
531
|
* @description
|
535
532
|
*
|
536
533
|
* Runs interval tasks scheduled to be run in the next `millis` milliseconds.
|
@@ -601,7 +598,7 @@ function padNumber(num, digits, trim) {
|
|
601
598
|
|
602
599
|
|
603
600
|
/**
|
604
|
-
* @ngdoc
|
601
|
+
* @ngdoc type
|
605
602
|
* @name angular.mock.TzDate
|
606
603
|
* @description
|
607
604
|
*
|
@@ -625,7 +622,7 @@ function padNumber(num, digits, trim) {
|
|
625
622
|
* incomplete we might be missing some non-standard methods. This can result in errors like:
|
626
623
|
* "Date.prototype.foo called on incompatible Object".
|
627
624
|
*
|
628
|
-
*
|
625
|
+
* ```js
|
629
626
|
* var newYearInBratislava = new TzDate(-1, '2009-12-31T23:00:00Z');
|
630
627
|
* newYearInBratislava.getTimezoneOffset() => -60;
|
631
628
|
* newYearInBratislava.getFullYear() => 2010;
|
@@ -634,7 +631,7 @@ function padNumber(num, digits, trim) {
|
|
634
631
|
* newYearInBratislava.getHours() => 0;
|
635
632
|
* newYearInBratislava.getMinutes() => 0;
|
636
633
|
* newYearInBratislava.getSeconds() => 0;
|
637
|
-
*
|
634
|
+
* ```
|
638
635
|
*
|
639
636
|
*/
|
640
637
|
angular.mock.TzDate = function (offset, timestamp) {
|
@@ -767,21 +764,24 @@ angular.mock.TzDate.prototype = Date.prototype;
|
|
767
764
|
angular.mock.animate = angular.module('ngAnimateMock', ['ng'])
|
768
765
|
|
769
766
|
.config(['$provide', function($provide) {
|
770
|
-
var reflowQueue = [];
|
771
767
|
|
768
|
+
var reflowQueue = [];
|
772
769
|
$provide.value('$$animateReflow', function(fn) {
|
770
|
+
var index = reflowQueue.length;
|
773
771
|
reflowQueue.push(fn);
|
774
|
-
return
|
772
|
+
return function cancel() {
|
773
|
+
reflowQueue.splice(index, 1);
|
774
|
+
};
|
775
775
|
});
|
776
776
|
|
777
|
-
$provide.decorator('$animate', function($delegate) {
|
777
|
+
$provide.decorator('$animate', function($delegate, $$asyncCallback) {
|
778
778
|
var animate = {
|
779
779
|
queue : [],
|
780
780
|
enabled : $delegate.enabled,
|
781
|
+
triggerCallbacks : function() {
|
782
|
+
$$asyncCallback.flush();
|
783
|
+
},
|
781
784
|
triggerReflow : function() {
|
782
|
-
if(reflowQueue.length === 0) {
|
783
|
-
throw new Error('No animation reflows present');
|
784
|
-
}
|
785
785
|
angular.forEach(reflowQueue, function(fn) {
|
786
786
|
fn();
|
787
787
|
});
|
@@ -878,8 +878,8 @@ angular.mock.dump = function(object) {
|
|
878
878
|
};
|
879
879
|
|
880
880
|
/**
|
881
|
-
* @ngdoc
|
882
|
-
* @name
|
881
|
+
* @ngdoc service
|
882
|
+
* @name $httpBackend
|
883
883
|
* @description
|
884
884
|
* Fake HTTP backend implementation suitable for unit testing applications that use the
|
885
885
|
* {@link ng.$http $http service}.
|
@@ -888,8 +888,8 @@ angular.mock.dump = function(object) {
|
|
888
888
|
* development please see {@link ngMockE2E.$httpBackend e2e $httpBackend mock}.
|
889
889
|
*
|
890
890
|
* During unit testing, we want our unit tests to run quickly and have no external dependencies so
|
891
|
-
* we don’t want to send
|
892
|
-
*
|
891
|
+
* we don’t want to send [XHR](https://developer.mozilla.org/en/xmlhttprequest) or
|
892
|
+
* [JSONP](http://en.wikipedia.org/wiki/JSONP) requests to a real server. All we really need is
|
893
893
|
* to verify whether a certain request has been sent or not, or alternatively just let the
|
894
894
|
* application make requests, respond with pre-trained responses and assert that the end result is
|
895
895
|
* what we expect it to be.
|
@@ -980,7 +980,7 @@ angular.mock.dump = function(object) {
|
|
980
980
|
* The following code shows how to setup and use the mock backend when unit testing a controller.
|
981
981
|
* First we create the controller under test:
|
982
982
|
*
|
983
|
-
|
983
|
+
```js
|
984
984
|
// The controller code
|
985
985
|
function MyController($scope, $http) {
|
986
986
|
var authToken;
|
@@ -1001,11 +1001,11 @@ angular.mock.dump = function(object) {
|
|
1001
1001
|
});
|
1002
1002
|
};
|
1003
1003
|
}
|
1004
|
-
|
1004
|
+
```
|
1005
1005
|
*
|
1006
1006
|
* Now we setup the mock backend and create the test specs:
|
1007
1007
|
*
|
1008
|
-
|
1008
|
+
```js
|
1009
1009
|
// testing controller
|
1010
1010
|
describe('MyController', function() {
|
1011
1011
|
var $httpBackend, $rootScope, createController;
|
@@ -1071,7 +1071,7 @@ angular.mock.dump = function(object) {
|
|
1071
1071
|
$httpBackend.flush();
|
1072
1072
|
});
|
1073
1073
|
});
|
1074
|
-
|
1074
|
+
```
|
1075
1075
|
*/
|
1076
1076
|
angular.mock.$HttpBackendProvider = function() {
|
1077
1077
|
this.$get = ['$rootScope', createHttpBackendMock];
|
@@ -1181,8 +1181,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
|
|
1181
1181
|
|
1182
1182
|
/**
|
1183
1183
|
* @ngdoc method
|
1184
|
-
* @name
|
1185
|
-
* @methodOf ngMock.$httpBackend
|
1184
|
+
* @name $httpBackend#when
|
1186
1185
|
* @description
|
1187
1186
|
* Creates a new backend definition.
|
1188
1187
|
*
|
@@ -1221,8 +1220,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
|
|
1221
1220
|
|
1222
1221
|
/**
|
1223
1222
|
* @ngdoc method
|
1224
|
-
* @name
|
1225
|
-
* @methodOf ngMock.$httpBackend
|
1223
|
+
* @name $httpBackend#whenGET
|
1226
1224
|
* @description
|
1227
1225
|
* Creates a new backend definition for GET requests. For more info see `when()`.
|
1228
1226
|
*
|
@@ -1234,8 +1232,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
|
|
1234
1232
|
|
1235
1233
|
/**
|
1236
1234
|
* @ngdoc method
|
1237
|
-
* @name
|
1238
|
-
* @methodOf ngMock.$httpBackend
|
1235
|
+
* @name $httpBackend#whenHEAD
|
1239
1236
|
* @description
|
1240
1237
|
* Creates a new backend definition for HEAD requests. For more info see `when()`.
|
1241
1238
|
*
|
@@ -1247,8 +1244,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
|
|
1247
1244
|
|
1248
1245
|
/**
|
1249
1246
|
* @ngdoc method
|
1250
|
-
* @name
|
1251
|
-
* @methodOf ngMock.$httpBackend
|
1247
|
+
* @name $httpBackend#whenDELETE
|
1252
1248
|
* @description
|
1253
1249
|
* Creates a new backend definition for DELETE requests. For more info see `when()`.
|
1254
1250
|
*
|
@@ -1260,8 +1256,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
|
|
1260
1256
|
|
1261
1257
|
/**
|
1262
1258
|
* @ngdoc method
|
1263
|
-
* @name
|
1264
|
-
* @methodOf ngMock.$httpBackend
|
1259
|
+
* @name $httpBackend#whenPOST
|
1265
1260
|
* @description
|
1266
1261
|
* Creates a new backend definition for POST requests. For more info see `when()`.
|
1267
1262
|
*
|
@@ -1275,8 +1270,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
|
|
1275
1270
|
|
1276
1271
|
/**
|
1277
1272
|
* @ngdoc method
|
1278
|
-
* @name
|
1279
|
-
* @methodOf ngMock.$httpBackend
|
1273
|
+
* @name $httpBackend#whenPUT
|
1280
1274
|
* @description
|
1281
1275
|
* Creates a new backend definition for PUT requests. For more info see `when()`.
|
1282
1276
|
*
|
@@ -1290,8 +1284,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
|
|
1290
1284
|
|
1291
1285
|
/**
|
1292
1286
|
* @ngdoc method
|
1293
|
-
* @name
|
1294
|
-
* @methodOf ngMock.$httpBackend
|
1287
|
+
* @name $httpBackend#whenJSONP
|
1295
1288
|
* @description
|
1296
1289
|
* Creates a new backend definition for JSONP requests. For more info see `when()`.
|
1297
1290
|
*
|
@@ -1304,8 +1297,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
|
|
1304
1297
|
|
1305
1298
|
/**
|
1306
1299
|
* @ngdoc method
|
1307
|
-
* @name
|
1308
|
-
* @methodOf ngMock.$httpBackend
|
1300
|
+
* @name $httpBackend#expect
|
1309
1301
|
* @description
|
1310
1302
|
* Creates a new request expectation.
|
1311
1303
|
*
|
@@ -1338,8 +1330,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
|
|
1338
1330
|
|
1339
1331
|
/**
|
1340
1332
|
* @ngdoc method
|
1341
|
-
* @name
|
1342
|
-
* @methodOf ngMock.$httpBackend
|
1333
|
+
* @name $httpBackend#expectGET
|
1343
1334
|
* @description
|
1344
1335
|
* Creates a new request expectation for GET requests. For more info see `expect()`.
|
1345
1336
|
*
|
@@ -1351,8 +1342,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
|
|
1351
1342
|
|
1352
1343
|
/**
|
1353
1344
|
* @ngdoc method
|
1354
|
-
* @name
|
1355
|
-
* @methodOf ngMock.$httpBackend
|
1345
|
+
* @name $httpBackend#expectHEAD
|
1356
1346
|
* @description
|
1357
1347
|
* Creates a new request expectation for HEAD requests. For more info see `expect()`.
|
1358
1348
|
*
|
@@ -1364,8 +1354,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
|
|
1364
1354
|
|
1365
1355
|
/**
|
1366
1356
|
* @ngdoc method
|
1367
|
-
* @name
|
1368
|
-
* @methodOf ngMock.$httpBackend
|
1357
|
+
* @name $httpBackend#expectDELETE
|
1369
1358
|
* @description
|
1370
1359
|
* Creates a new request expectation for DELETE requests. For more info see `expect()`.
|
1371
1360
|
*
|
@@ -1377,8 +1366,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
|
|
1377
1366
|
|
1378
1367
|
/**
|
1379
1368
|
* @ngdoc method
|
1380
|
-
* @name
|
1381
|
-
* @methodOf ngMock.$httpBackend
|
1369
|
+
* @name $httpBackend#expectPOST
|
1382
1370
|
* @description
|
1383
1371
|
* Creates a new request expectation for POST requests. For more info see `expect()`.
|
1384
1372
|
*
|
@@ -1393,8 +1381,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
|
|
1393
1381
|
|
1394
1382
|
/**
|
1395
1383
|
* @ngdoc method
|
1396
|
-
* @name
|
1397
|
-
* @methodOf ngMock.$httpBackend
|
1384
|
+
* @name $httpBackend#expectPUT
|
1398
1385
|
* @description
|
1399
1386
|
* Creates a new request expectation for PUT requests. For more info see `expect()`.
|
1400
1387
|
*
|
@@ -1409,8 +1396,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
|
|
1409
1396
|
|
1410
1397
|
/**
|
1411
1398
|
* @ngdoc method
|
1412
|
-
* @name
|
1413
|
-
* @methodOf ngMock.$httpBackend
|
1399
|
+
* @name $httpBackend#expectPATCH
|
1414
1400
|
* @description
|
1415
1401
|
* Creates a new request expectation for PATCH requests. For more info see `expect()`.
|
1416
1402
|
*
|
@@ -1425,8 +1411,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
|
|
1425
1411
|
|
1426
1412
|
/**
|
1427
1413
|
* @ngdoc method
|
1428
|
-
* @name
|
1429
|
-
* @methodOf ngMock.$httpBackend
|
1414
|
+
* @name $httpBackend#expectJSONP
|
1430
1415
|
* @description
|
1431
1416
|
* Creates a new request expectation for JSONP requests. For more info see `expect()`.
|
1432
1417
|
*
|
@@ -1439,8 +1424,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
|
|
1439
1424
|
|
1440
1425
|
/**
|
1441
1426
|
* @ngdoc method
|
1442
|
-
* @name
|
1443
|
-
* @methodOf ngMock.$httpBackend
|
1427
|
+
* @name $httpBackend#flush
|
1444
1428
|
* @description
|
1445
1429
|
* Flushes all pending requests using the trained responses.
|
1446
1430
|
*
|
@@ -1468,8 +1452,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
|
|
1468
1452
|
|
1469
1453
|
/**
|
1470
1454
|
* @ngdoc method
|
1471
|
-
* @name
|
1472
|
-
* @methodOf ngMock.$httpBackend
|
1455
|
+
* @name $httpBackend#verifyNoOutstandingExpectation
|
1473
1456
|
* @description
|
1474
1457
|
* Verifies that all of the requests defined via the `expect` api were made. If any of the
|
1475
1458
|
* requests were not made, verifyNoOutstandingExpectation throws an exception.
|
@@ -1477,9 +1460,9 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
|
|
1477
1460
|
* Typically, you would call this method following each test case that asserts requests using an
|
1478
1461
|
* "afterEach" clause.
|
1479
1462
|
*
|
1480
|
-
*
|
1463
|
+
* ```js
|
1481
1464
|
* afterEach($httpBackend.verifyNoOutstandingExpectation);
|
1482
|
-
*
|
1465
|
+
* ```
|
1483
1466
|
*/
|
1484
1467
|
$httpBackend.verifyNoOutstandingExpectation = function() {
|
1485
1468
|
$rootScope.$digest();
|
@@ -1491,17 +1474,16 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
|
|
1491
1474
|
|
1492
1475
|
/**
|
1493
1476
|
* @ngdoc method
|
1494
|
-
* @name
|
1495
|
-
* @methodOf ngMock.$httpBackend
|
1477
|
+
* @name $httpBackend#verifyNoOutstandingRequest
|
1496
1478
|
* @description
|
1497
1479
|
* Verifies that there are no outstanding requests that need to be flushed.
|
1498
1480
|
*
|
1499
1481
|
* Typically, you would call this method following each test case that asserts requests using an
|
1500
1482
|
* "afterEach" clause.
|
1501
1483
|
*
|
1502
|
-
*
|
1484
|
+
* ```js
|
1503
1485
|
* afterEach($httpBackend.verifyNoOutstandingRequest);
|
1504
|
-
*
|
1486
|
+
* ```
|
1505
1487
|
*/
|
1506
1488
|
$httpBackend.verifyNoOutstandingRequest = function() {
|
1507
1489
|
if (responses.length) {
|
@@ -1512,8 +1494,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
|
|
1512
1494
|
|
1513
1495
|
/**
|
1514
1496
|
* @ngdoc method
|
1515
|
-
* @name
|
1516
|
-
* @methodOf ngMock.$httpBackend
|
1497
|
+
* @name $httpBackend#resetExpectations
|
1517
1498
|
* @description
|
1518
1499
|
* Resets all request expectations, but preserves all backend definitions. Typically, you would
|
1519
1500
|
* call resetExpectations during a multiple-phase test when you want to reuse the same instance of
|
@@ -1636,8 +1617,8 @@ function MockXhr() {
|
|
1636
1617
|
|
1637
1618
|
|
1638
1619
|
/**
|
1639
|
-
* @ngdoc
|
1640
|
-
* @name
|
1620
|
+
* @ngdoc service
|
1621
|
+
* @name $timeout
|
1641
1622
|
* @description
|
1642
1623
|
*
|
1643
1624
|
* This service is just a simple decorator for {@link ng.$timeout $timeout} service
|
@@ -1648,8 +1629,7 @@ angular.mock.$TimeoutDecorator = function($delegate, $browser) {
|
|
1648
1629
|
|
1649
1630
|
/**
|
1650
1631
|
* @ngdoc method
|
1651
|
-
* @name
|
1652
|
-
* @methodOf ngMock.$timeout
|
1632
|
+
* @name $timeout#flush
|
1653
1633
|
* @description
|
1654
1634
|
*
|
1655
1635
|
* Flushes the queue of pending tasks.
|
@@ -1662,8 +1642,7 @@ angular.mock.$TimeoutDecorator = function($delegate, $browser) {
|
|
1662
1642
|
|
1663
1643
|
/**
|
1664
1644
|
* @ngdoc method
|
1665
|
-
* @name
|
1666
|
-
* @methodOf ngMock.$timeout
|
1645
|
+
* @name $timeout#verifyNoPendingTasks
|
1667
1646
|
* @description
|
1668
1647
|
*
|
1669
1648
|
* Verifies that there are no pending tasks that need to be flushed.
|
@@ -1687,6 +1666,48 @@ angular.mock.$TimeoutDecorator = function($delegate, $browser) {
|
|
1687
1666
|
return $delegate;
|
1688
1667
|
};
|
1689
1668
|
|
1669
|
+
angular.mock.$RAFDecorator = function($delegate) {
|
1670
|
+
var queue = [];
|
1671
|
+
var rafFn = function(fn) {
|
1672
|
+
var index = queue.length;
|
1673
|
+
queue.push(fn);
|
1674
|
+
return function() {
|
1675
|
+
queue.splice(index, 1);
|
1676
|
+
};
|
1677
|
+
};
|
1678
|
+
|
1679
|
+
rafFn.supported = $delegate.supported;
|
1680
|
+
|
1681
|
+
rafFn.flush = function() {
|
1682
|
+
if(queue.length === 0) {
|
1683
|
+
throw new Error('No rAF callbacks present');
|
1684
|
+
}
|
1685
|
+
|
1686
|
+
var length = queue.length;
|
1687
|
+
for(var i=0;i<length;i++) {
|
1688
|
+
queue[i]();
|
1689
|
+
}
|
1690
|
+
|
1691
|
+
queue = [];
|
1692
|
+
};
|
1693
|
+
|
1694
|
+
return rafFn;
|
1695
|
+
};
|
1696
|
+
|
1697
|
+
angular.mock.$AsyncCallbackDecorator = function($delegate) {
|
1698
|
+
var callbacks = [];
|
1699
|
+
var addFn = function(fn) {
|
1700
|
+
callbacks.push(fn);
|
1701
|
+
};
|
1702
|
+
addFn.flush = function() {
|
1703
|
+
angular.forEach(callbacks, function(fn) {
|
1704
|
+
fn();
|
1705
|
+
});
|
1706
|
+
callbacks = [];
|
1707
|
+
};
|
1708
|
+
return addFn;
|
1709
|
+
};
|
1710
|
+
|
1690
1711
|
/**
|
1691
1712
|
*
|
1692
1713
|
*/
|
@@ -1697,7 +1718,7 @@ angular.mock.$RootElementProvider = function() {
|
|
1697
1718
|
};
|
1698
1719
|
|
1699
1720
|
/**
|
1700
|
-
* @ngdoc
|
1721
|
+
* @ngdoc module
|
1701
1722
|
* @name ngMock
|
1702
1723
|
* @description
|
1703
1724
|
*
|
@@ -1707,7 +1728,6 @@ angular.mock.$RootElementProvider = function() {
|
|
1707
1728
|
* In addition, ngMock also extends various core ng services such that they can be
|
1708
1729
|
* inspected and controlled in a synchronous manner within test code.
|
1709
1730
|
*
|
1710
|
-
* {@installModule mock}
|
1711
1731
|
*
|
1712
1732
|
* <div doc-module-components="ngMock"></div>
|
1713
1733
|
*
|
@@ -1721,11 +1741,14 @@ angular.module('ngMock', ['ng']).provider({
|
|
1721
1741
|
$rootElement: angular.mock.$RootElementProvider
|
1722
1742
|
}).config(['$provide', function($provide) {
|
1723
1743
|
$provide.decorator('$timeout', angular.mock.$TimeoutDecorator);
|
1744
|
+
$provide.decorator('$$rAF', angular.mock.$RAFDecorator);
|
1745
|
+
$provide.decorator('$$asyncCallback', angular.mock.$AsyncCallbackDecorator);
|
1724
1746
|
}]);
|
1725
1747
|
|
1726
1748
|
/**
|
1727
|
-
* @ngdoc
|
1749
|
+
* @ngdoc module
|
1728
1750
|
* @name ngMockE2E
|
1751
|
+
* @module ngMockE2E
|
1729
1752
|
* @description
|
1730
1753
|
*
|
1731
1754
|
* The `ngMockE2E` is an angular module which contains mocks suitable for end-to-end testing.
|
@@ -1737,8 +1760,9 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) {
|
|
1737
1760
|
}]);
|
1738
1761
|
|
1739
1762
|
/**
|
1740
|
-
* @ngdoc
|
1741
|
-
* @name
|
1763
|
+
* @ngdoc service
|
1764
|
+
* @name $httpBackend
|
1765
|
+
* @module ngMockE2E
|
1742
1766
|
* @description
|
1743
1767
|
* Fake HTTP backend implementation suitable for end-to-end testing or backend-less development of
|
1744
1768
|
* applications that use the {@link ng.$http $http service}.
|
@@ -1764,7 +1788,7 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) {
|
|
1764
1788
|
* To setup the application to run with this http backend, you have to create a module that depends
|
1765
1789
|
* on the `ngMockE2E` and your application modules and defines the fake backend:
|
1766
1790
|
*
|
1767
|
-
*
|
1791
|
+
* ```js
|
1768
1792
|
* myAppDev = angular.module('myAppDev', ['myApp', 'ngMockE2E']);
|
1769
1793
|
* myAppDev.run(function($httpBackend) {
|
1770
1794
|
* phones = [{name: 'phone1'}, {name: 'phone2'}];
|
@@ -1779,15 +1803,15 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) {
|
|
1779
1803
|
* $httpBackend.whenGET(/^\/templates\//).passThrough();
|
1780
1804
|
* //...
|
1781
1805
|
* });
|
1782
|
-
*
|
1806
|
+
* ```
|
1783
1807
|
*
|
1784
1808
|
* Afterwards, bootstrap your app with this new module.
|
1785
1809
|
*/
|
1786
1810
|
|
1787
1811
|
/**
|
1788
1812
|
* @ngdoc method
|
1789
|
-
* @name
|
1790
|
-
* @
|
1813
|
+
* @name $httpBackend#when
|
1814
|
+
* @module ngMockE2E
|
1791
1815
|
* @description
|
1792
1816
|
* Creates a new backend definition.
|
1793
1817
|
*
|
@@ -1811,8 +1835,8 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) {
|
|
1811
1835
|
|
1812
1836
|
/**
|
1813
1837
|
* @ngdoc method
|
1814
|
-
* @name
|
1815
|
-
* @
|
1838
|
+
* @name $httpBackend#whenGET
|
1839
|
+
* @module ngMockE2E
|
1816
1840
|
* @description
|
1817
1841
|
* Creates a new backend definition for GET requests. For more info see `when()`.
|
1818
1842
|
*
|
@@ -1824,8 +1848,8 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) {
|
|
1824
1848
|
|
1825
1849
|
/**
|
1826
1850
|
* @ngdoc method
|
1827
|
-
* @name
|
1828
|
-
* @
|
1851
|
+
* @name $httpBackend#whenHEAD
|
1852
|
+
* @module ngMockE2E
|
1829
1853
|
* @description
|
1830
1854
|
* Creates a new backend definition for HEAD requests. For more info see `when()`.
|
1831
1855
|
*
|
@@ -1837,8 +1861,8 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) {
|
|
1837
1861
|
|
1838
1862
|
/**
|
1839
1863
|
* @ngdoc method
|
1840
|
-
* @name
|
1841
|
-
* @
|
1864
|
+
* @name $httpBackend#whenDELETE
|
1865
|
+
* @module ngMockE2E
|
1842
1866
|
* @description
|
1843
1867
|
* Creates a new backend definition for DELETE requests. For more info see `when()`.
|
1844
1868
|
*
|
@@ -1850,8 +1874,8 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) {
|
|
1850
1874
|
|
1851
1875
|
/**
|
1852
1876
|
* @ngdoc method
|
1853
|
-
* @name
|
1854
|
-
* @
|
1877
|
+
* @name $httpBackend#whenPOST
|
1878
|
+
* @module ngMockE2E
|
1855
1879
|
* @description
|
1856
1880
|
* Creates a new backend definition for POST requests. For more info see `when()`.
|
1857
1881
|
*
|
@@ -1864,8 +1888,8 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) {
|
|
1864
1888
|
|
1865
1889
|
/**
|
1866
1890
|
* @ngdoc method
|
1867
|
-
* @name
|
1868
|
-
* @
|
1891
|
+
* @name $httpBackend#whenPUT
|
1892
|
+
* @module ngMockE2E
|
1869
1893
|
* @description
|
1870
1894
|
* Creates a new backend definition for PUT requests. For more info see `when()`.
|
1871
1895
|
*
|
@@ -1878,8 +1902,8 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) {
|
|
1878
1902
|
|
1879
1903
|
/**
|
1880
1904
|
* @ngdoc method
|
1881
|
-
* @name
|
1882
|
-
* @
|
1905
|
+
* @name $httpBackend#whenPATCH
|
1906
|
+
* @module ngMockE2E
|
1883
1907
|
* @description
|
1884
1908
|
* Creates a new backend definition for PATCH requests. For more info see `when()`.
|
1885
1909
|
*
|
@@ -1892,8 +1916,8 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) {
|
|
1892
1916
|
|
1893
1917
|
/**
|
1894
1918
|
* @ngdoc method
|
1895
|
-
* @name
|
1896
|
-
* @
|
1919
|
+
* @name $httpBackend#whenJSONP
|
1920
|
+
* @module ngMockE2E
|
1897
1921
|
* @description
|
1898
1922
|
* Creates a new backend definition for JSONP requests. For more info see `when()`.
|
1899
1923
|
*
|
@@ -2010,7 +2034,7 @@ if(window.jasmine || window.mocha) {
|
|
2010
2034
|
* *NOTE*: This function is also published on window for easy access.<br>
|
2011
2035
|
*
|
2012
2036
|
* The inject function wraps a function into an injectable function. The inject() creates new
|
2013
|
-
* instance of {@link
|
2037
|
+
* instance of {@link auto.$injector $injector} per test, which is then used for
|
2014
2038
|
* resolving references.
|
2015
2039
|
*
|
2016
2040
|
*
|
@@ -2048,7 +2072,7 @@ if(window.jasmine || window.mocha) {
|
|
2048
2072
|
*
|
2049
2073
|
* ## Example
|
2050
2074
|
* Example of what a typical jasmine tests looks like with the inject method.
|
2051
|
-
*
|
2075
|
+
* ```js
|
2052
2076
|
*
|
2053
2077
|
* angular.module('myApplicationModule', [])
|
2054
2078
|
* .value('mode', 'app')
|
@@ -2082,7 +2106,7 @@ if(window.jasmine || window.mocha) {
|
|
2082
2106
|
* });
|
2083
2107
|
* });
|
2084
2108
|
*
|
2085
|
-
*
|
2109
|
+
* ```
|
2086
2110
|
*
|
2087
2111
|
* @param {...Function} fns any number of functions which will be injected using the injector.
|
2088
2112
|
*/
|