rails-angularjs 1.4.9 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/rails-angularjs/version.rb +1 -1
- data/vendor/assets/javascripts/angular-animate.js +296 -48
- data/vendor/assets/javascripts/angular-animate.min.js +52 -51
- data/vendor/assets/javascripts/angular-animate.min.js.map +3 -3
- data/vendor/assets/javascripts/angular-aria.js +51 -51
- data/vendor/assets/javascripts/angular-aria.min.js +10 -10
- data/vendor/assets/javascripts/angular-aria.min.js.map +2 -2
- data/vendor/assets/javascripts/angular-cookies.js +9 -8
- data/vendor/assets/javascripts/angular-cookies.min.js +2 -2
- data/vendor/assets/javascripts/angular-cookies.min.js.map +1 -1
- data/vendor/assets/javascripts/angular-loader.js +16 -3
- data/vendor/assets/javascripts/angular-loader.min.js +5 -5
- data/vendor/assets/javascripts/angular-loader.min.js.map +2 -2
- data/vendor/assets/javascripts/angular-message-format.js +2 -2
- data/vendor/assets/javascripts/angular-message-format.min.js +2 -2
- data/vendor/assets/javascripts/angular-messages.js +7 -5
- data/vendor/assets/javascripts/angular-messages.min.js +8 -8
- data/vendor/assets/javascripts/angular-messages.min.js.map +2 -2
- data/vendor/assets/javascripts/angular-mocks.js +323 -30
- data/vendor/assets/javascripts/angular-resource.js +116 -42
- data/vendor/assets/javascripts/angular-resource.min.js +11 -10
- data/vendor/assets/javascripts/angular-resource.min.js.map +3 -3
- data/vendor/assets/javascripts/angular-route.js +36 -11
- data/vendor/assets/javascripts/angular-route.min.js +11 -11
- data/vendor/assets/javascripts/angular-route.min.js.map +2 -2
- data/vendor/assets/javascripts/angular-sanitize.js +280 -246
- data/vendor/assets/javascripts/angular-sanitize.min.js +11 -12
- data/vendor/assets/javascripts/angular-sanitize.min.js.map +3 -3
- data/vendor/assets/javascripts/angular-scenario.js +1227 -456
- data/vendor/assets/javascripts/angular-touch.js +114 -12
- data/vendor/assets/javascripts/angular-touch.min.js +10 -9
- data/vendor/assets/javascripts/angular-touch.min.js.map +3 -3
- data/vendor/assets/javascripts/angular.js +1227 -456
- data/vendor/assets/javascripts/angular.min.js +302 -293
- data/vendor/assets/javascripts/angular.min.js.map +3 -3
- metadata +1 -1
@@ -1,10 +1,10 @@
|
|
1
1
|
/*
|
2
|
-
AngularJS v1.
|
3
|
-
(c) 2010-
|
2
|
+
AngularJS v1.5.0
|
3
|
+
(c) 2010-2016 Google, Inc. http://angularjs.org
|
4
4
|
License: MIT
|
5
5
|
*/
|
6
|
-
(function(){'use strict';function d(b){return function(){var a=arguments[0],e;e="["+(b?b+":":"")+a+"] http://errors.angularjs.org/1.
|
6
|
+
(function(){'use strict';function d(b){return function(){var a=arguments[0],e;e="["+(b?b+":":"")+a+"] http://errors.angularjs.org/1.5.0/"+(b?b+"/":"")+a;for(a=1;a<arguments.length;a++){e=e+(1==a?"?":"&")+"p"+(a-1)+"=";var d=encodeURIComponent,c;c=arguments[a];c="function"==typeof c?c.toString().replace(/ \{[\s\S]*$/,""):"undefined"==typeof c?"undefined":"string"!=typeof c?JSON.stringify(c):c;e+=d(c)}return Error(e)}}(function(b){function a(c,a,b){return c[a]||(c[a]=b())}var e=d("$injector"),n=d("ng");
|
7
7
|
b=a(b,"angular",Object);b.$$minErr=b.$$minErr||d;return a(b,"module",function(){var c={};return function(b,d,h){if("hasOwnProperty"===b)throw n("badname","module");d&&c.hasOwnProperty(b)&&(c[b]=null);return a(c,b,function(){function c(a,b,d,e){e||(e=f);return function(){e[d||"push"]([a,b,arguments]);return g}}function a(c,e){return function(a,d){d&&"function"===typeof d&&(d.$$moduleName=b);f.push([c,e,arguments]);return g}}if(!d)throw e("nomod",b);var f=[],k=[],l=[],m=c("$injector","invoke","push",
|
8
|
-
k),g={_invokeQueue:f,_configBlocks:k,_runBlocks:l,requires:d,name:b,provider:a("$provide","provider"),factory:a("$provide","factory"),service:a("$provide","service"),value:c("$provide","value"),constant:c("$provide","constant","unshift"),decorator:a("$provide","decorator"),animation:a("$animateProvider","register"),filter:a("$filterProvider","register"),controller:a("$controllerProvider","register"),directive:a("$compileProvider","directive"),config:m,run:function(a){l.push(a);
|
9
|
-
return g})}})})(window)})(window);
|
8
|
+
k),g={_invokeQueue:f,_configBlocks:k,_runBlocks:l,requires:d,name:b,provider:a("$provide","provider"),factory:a("$provide","factory"),service:a("$provide","service"),value:c("$provide","value"),constant:c("$provide","constant","unshift"),decorator:a("$provide","decorator"),animation:a("$animateProvider","register"),filter:a("$filterProvider","register"),controller:a("$controllerProvider","register"),directive:a("$compileProvider","directive"),component:a("$compileProvider","component"),config:m,run:function(a){l.push(a);
|
9
|
+
return this}};h&&m(h);return g})}})})(window)})(window);
|
10
10
|
//# sourceMappingURL=angular-loader.min.js.map
|
@@ -2,7 +2,7 @@
|
|
2
2
|
"version":3,
|
3
3
|
"file":"angular-loader.min.js",
|
4
4
|
"lineCount":9,
|
5
|
-
"mappings":"A;;;;;aAMC,SAAQ,EAAG,CA6DZA,QAAAA,EAAAA,CAAAA,CAAAA,CAAAA,CAAAA,MAAAA,SAAAA,EAAAA,CAAAA,IAAAA,EAAAA,SAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,EAAAA,CAAAA,GAAAA,EAAAA,CAAAA,CAAAA,CAAAA,CAAAA,GAAAA,CAAAA,EAAAA,EAAAA,CAAAA,CAAAA,sCAAAA,EAAAA,CAAAA,CAAAA,CAAAA,CAAAA,GAAAA,CAAAA,EAAAA,EAAAA,CAAAA,KAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,SAAAA,OAAAA,CAAAA,CAAAA,EAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,EAAAA,CAAAA,EAAAA,CAAAA,CAAAA,GAAAA,CAAAA,GAAAA,EAAAA,GAAAA,EAAAA,CAAAA,CAAAA,CAAAA,EAAAA,GAAAA,KAAAA,EAAAA,kBAAAA,CAAAA,CAAAA,EAAAA,CAAAA,SAAA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CAAkBC,MAAlB,CAzcY,CAAX,CAAD,CA0cGA,MA1cH;",
|
6
6
|
"sources":["angular-loader.js"],
|
7
|
-
"names":["minErr","setupModuleLoader","window","ensure","obj","name","factory","$injectorMinErr","ngMinErr","angular","Object","$$minErr","modules","module","requires","configFn","context","hasOwnProperty","invokeLater","provider","method","insertMethod","queue","invokeQueue","arguments","moduleInstance","invokeLaterAndSetModuleName","recipeName","factoryFunction","$$moduleName","push","configBlocks","runBlocks","config","_invokeQueue","_configBlocks","_runBlocks","service","value","constant","decorator","animation","filter","controller","directive","run","block"]
|
7
|
+
"names":["minErr","setupModuleLoader","window","ensure","obj","name","factory","$injectorMinErr","ngMinErr","angular","Object","$$minErr","modules","module","requires","configFn","context","hasOwnProperty","invokeLater","provider","method","insertMethod","queue","invokeQueue","arguments","moduleInstance","invokeLaterAndSetModuleName","recipeName","factoryFunction","$$moduleName","push","configBlocks","runBlocks","config","_invokeQueue","_configBlocks","_runBlocks","service","value","constant","decorator","animation","filter","controller","directive","component","run","block"]
|
8
8
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
|
-
AngularJS v1.
|
3
|
-
(c) 2010-
|
2
|
+
AngularJS v1.5.0
|
3
|
+
(c) 2010-2016 Google, Inc. http://angularjs.org
|
4
4
|
License: MIT
|
5
5
|
*/
|
6
6
|
(function(h){'use strict';function C(a){if(null==a)return"";switch(typeof a){case "string":return a;case "number":return""+a;default:return D(a)}}function f(a,b){for(var d=a.split(/\n/g),k=0;k<d.length;k++){var c=d[k];if(b>=c.length)b-=c.length;else return{h:k+1,f:b+1}}}function t(a){function b(){return a}var d=u[a];if(null!=d)return d;b.$$watchDelegate=function(b,d,c){var e=b.$watch(v,function(){m(d)&&d.call(null,a,a,b);e()},c);return e};u[a]=b;b.exp=a;b.expressions=[];return b}function F(a,b){function d(a){return void 0==
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/**
|
2
|
-
* @license AngularJS v1.
|
3
|
-
* (c) 2010-
|
2
|
+
* @license AngularJS v1.5.0
|
3
|
+
* (c) 2010-2016 Google, Inc. http://angularjs.org
|
4
4
|
* License: MIT
|
5
5
|
*/
|
6
6
|
(function(window, angular, undefined) {'use strict';
|
@@ -570,13 +570,14 @@ angular.module('ngMessages', [])
|
|
570
570
|
*
|
571
571
|
* @param {expression} ngMessage|when a string value corresponding to the message key.
|
572
572
|
*/
|
573
|
-
.directive('ngMessage', ngMessageDirectiveFactory(
|
573
|
+
.directive('ngMessage', ngMessageDirectiveFactory())
|
574
574
|
|
575
575
|
|
576
576
|
/**
|
577
577
|
* @ngdoc directive
|
578
578
|
* @name ngMessageExp
|
579
579
|
* @restrict AE
|
580
|
+
* @priority 1
|
580
581
|
* @scope
|
581
582
|
*
|
582
583
|
* @description
|
@@ -602,13 +603,14 @@ angular.module('ngMessages', [])
|
|
602
603
|
*
|
603
604
|
* @param {expression} ngMessageExp|whenExp an expression value corresponding to the message key.
|
604
605
|
*/
|
605
|
-
.directive('ngMessageExp', ngMessageDirectiveFactory(
|
606
|
+
.directive('ngMessageExp', ngMessageDirectiveFactory());
|
606
607
|
|
607
|
-
function ngMessageDirectiveFactory(
|
608
|
+
function ngMessageDirectiveFactory() {
|
608
609
|
return ['$animate', function($animate) {
|
609
610
|
return {
|
610
611
|
restrict: 'AE',
|
611
612
|
transclude: 'element',
|
613
|
+
priority: 1, // must run before ngBind, otherwise the text is set on the comment
|
612
614
|
terminal: true,
|
613
615
|
require: '^^ngMessages',
|
614
616
|
link: function(scope, element, attrs, ngMessagesCtrl, $transclude) {
|
@@ -1,12 +1,12 @@
|
|
1
1
|
/*
|
2
|
-
AngularJS v1.
|
3
|
-
(c) 2010-
|
2
|
+
AngularJS v1.5.0
|
3
|
+
(c) 2010-2016 Google, Inc. http://angularjs.org
|
4
4
|
License: MIT
|
5
5
|
*/
|
6
|
-
(function(
|
7
|
-
null,
|
8
|
-
|
9
|
-
!k[
|
10
|
-
this.deregister=function(b){var
|
11
|
-
|
6
|
+
(function(A,d,B){'use strict';function l(){return["$animate",function(v){return{restrict:"AE",transclude:"element",priority:1,terminal:!0,require:"^^ngMessages",link:function(n,r,a,b,m){var k=r[0],f,p=a.ngMessage||a.when;a=a.ngMessageExp||a.whenExp;var d=function(a){f=a?w(a)?a:a.split(/[\s,]+/):null;b.reRender()};a?(d(n.$eval(a)),n.$watchCollection(a,d)):d(p);var e,q;b.register(k,q={test:function(a){var g=f;a=g?w(g)?0<=g.indexOf(a):g.hasOwnProperty(a):void 0;return a},attach:function(){e||m(n,function(a){v.enter(a,
|
7
|
+
null,r);e=a;var g=e.$$attachId=b.getAttachId();e.on("$destroy",function(){e&&e.$$attachId===g&&(b.deregister(k),q.detach())})})},detach:function(){if(e){var a=e;e=null;v.leave(a)}}})}}}]}var w=d.isArray,x=d.forEach,y=d.isString,z=d.element;d.module("ngMessages",[]).directive("ngMessages",["$animate",function(d){function n(a,b){return y(b)&&0===b.length||r(a.$eval(b))}function r(a){return y(a)?a.length:!!a}return{require:"ngMessages",restrict:"AE",controller:["$element","$scope","$attrs",function(a,
|
8
|
+
b,m){function k(a,b){for(var c=b,f=[];c&&c!==a;){var h=c.$$ngMessageNode;if(h&&h.length)return e[h];c.childNodes.length&&-1==f.indexOf(c)?(f.push(c),c=c.childNodes[c.childNodes.length-1]):c=c.previousSibling||c.parentNode}}var f=this,p=0,l=0;this.getAttachId=function(){return l++};var e=this.messages={},q,s;this.render=function(g){g=g||{};q=!1;s=g;for(var e=n(b,m.ngMessagesMultiple)||n(b,m.multiple),c=[],k={},h=f.head,p=!1,l=0;null!=h;){l++;var t=h.message,u=!1;p||x(g,function(a,c){!u&&r(a)&&t.test(c)&&
|
9
|
+
!k[c]&&(u=k[c]=!0,t.attach())});u?p=!e:c.push(t);h=h.next}x(c,function(a){a.detach()});c.length!==l?d.setClass(a,"ng-active","ng-inactive"):d.setClass(a,"ng-inactive","ng-active")};b.$watchCollection(m.ngMessages||m["for"],f.render);this.reRender=function(){q||(q=!0,b.$evalAsync(function(){q&&s&&f.render(s)}))};this.register=function(g,b){var c=p.toString();e[c]={message:b};var d=a[0],h=e[c];f.head?(d=k(d,g))?(h.next=d.next,d.next=h):(h.next=f.head,f.head=h):f.head=h;g.$$ngMessageNode=c;p++;f.reRender()};
|
10
|
+
this.deregister=function(b){var d=b.$$ngMessageNode;delete b.$$ngMessageNode;var c=e[d];(b=k(a[0],b))?b.next=c.next:f.head=c.next;delete e[d];f.reRender()}}]}}]).directive("ngMessagesInclude",["$templateRequest","$document","$compile",function(d,n,l){return{restrict:"AE",require:"^^ngMessages",link:function(a,b,m){var k=m.ngMessagesInclude||m.src;d(k).then(function(d){l(d)(a,function(a){b.after(a);a=z(n[0].createComment(" ngMessagesInclude: "+k+" "));b.after(a);b.remove()})})}}}]).directive("ngMessage",
|
11
|
+
l()).directive("ngMessageExp",l())})(window,window.angular);
|
12
12
|
//# sourceMappingURL=angular-messages.min.js.map
|
@@ -2,7 +2,7 @@
|
|
2
2
|
"version":3,
|
3
3
|
"file":"angular-messages.min.js",
|
4
4
|
"lineCount":11,
|
5
|
-
"mappings":"A;;;;;aAKC,SAAQ,CAACA,CAAD,CAASC,CAAT,CAAkBC,CAAlB,CAA6B,
|
5
|
+
"mappings":"A;;;;;aAKC,SAAQ,CAACA,CAAD,CAASC,CAAT,CAAkBC,CAAlB,CAA6B,CA0lBtCC,QAASA,EAAyB,EAAG,CACnC,MAAO,CAAC,UAAD,CAAa,QAAQ,CAACC,CAAD,CAAW,CACrC,MAAO,CACLC,SAAU,IADL,CAELC,WAAY,SAFP,CAGLC,SAAU,CAHL,CAILC,SAAU,CAAA,CAJL,CAKLC,QAAS,cALJ,CAMLC,KAAMA,QAAQ,CAACC,CAAD,CAAQC,CAAR,CAAiBC,CAAjB,CAAwBC,CAAxB,CAAwCC,CAAxC,CAAqD,CACjE,IAAIC,EAAcJ,CAAA,CAAQ,CAAR,CAAlB,CAEIK,CAFJ,CAGIC,EAAYL,CAAAM,UAAZD,EAA+BL,CAAAO,KAC/BC,EAAAA,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,MAAA,CAAcC,CAAd,CAGAxG,EAAA0G,OAAA,EARwC,CAA1C,CADwC,CAA1C,CAFqC,CAHlC,CAFuF,CAA9F,CA7QL,CAAAlE,UAAA,CAoUa,WApUb;AAoU0BjD,CAAA,EApU1B,CAAAiD,UAAA,CAqWa,cArWb,CAqW6BjD,CAAA,EArW7B,CAnPsC,CAArC,CAAD,CAyqBGH,MAzqBH,CAyqBWA,MAAAC,QAzqBX;",
|
6
6
|
"sources":["angular-messages.js"],
|
7
|
-
"names":["window","angular","undefined","ngMessageDirectiveFactory","
|
7
|
+
"names":["window","angular","undefined","ngMessageDirectiveFactory","$animate","restrict","transclude","priority","terminal","require","link","scope","element","attrs","ngMessagesCtrl","$transclude","commentNode","records","staticExp","ngMessage","when","dynamicExp","ngMessageExp","whenExp","assignRecords","items","isArray","split","reRender","$eval","$watchCollection","currentElement","messageCtrl","register","test","name","collection","indexOf","hasOwnProperty","attach","elm","enter","$$attachId","getAttachId","on","deregister","detach","leave","forEach","isString","jqLite","module","directive","isAttrTruthy","attr","length","truthy","val","controller","$element","$scope","$attrs","findPreviousMessage","parent","comment","prevNode","parentLookup","prevKey","$$ngMessageNode","messages","childNodes","push","previousSibling","parentNode","ctrl","latestKey","nextAttachId","this.getAttachId","renderLater","cachedCollection","render","this.render","multiple","ngMessagesMultiple","unmatchedMessages","matchedKeys","messageItem","head","messageFound","totalMessages","message","messageUsed","value","key","next","setClass","ACTIVE_CLASS","INACTIVE_CLASS","ngMessages","this.reRender","$evalAsync","this.register","nextKey","toString","messageNode","match","this.deregister","$templateRequest","$document","$compile","src","ngMessagesInclude","then","html","contents","after","anchor","createComment","remove"]
|
8
8
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/**
|
2
|
-
* @license AngularJS v1.
|
3
|
-
* (c) 2010-
|
2
|
+
* @license AngularJS v1.5.0
|
3
|
+
* (c) 2010-2016 Google, Inc. http://angularjs.org
|
4
4
|
* License: MIT
|
5
5
|
*/
|
6
6
|
(function(window, angular, undefined) {
|
@@ -1028,7 +1028,7 @@ angular.mock.dump = function(object) {
|
|
1028
1028
|
* - `$httpBackend.when` - specifies a backend definition
|
1029
1029
|
*
|
1030
1030
|
*
|
1031
|
-
*
|
1031
|
+
* ## Request Expectations vs Backend Definitions
|
1032
1032
|
*
|
1033
1033
|
* Request expectations provide a way to make assertions about requests made by the application and
|
1034
1034
|
* to define responses for those requests. The test will fail if the expected requests are not made
|
@@ -1084,7 +1084,7 @@ angular.mock.dump = function(object) {
|
|
1084
1084
|
* the request. The response from the first matched definition is returned.
|
1085
1085
|
*
|
1086
1086
|
*
|
1087
|
-
*
|
1087
|
+
* ## Flushing HTTP requests
|
1088
1088
|
*
|
1089
1089
|
* The $httpBackend used in production always responds to requests asynchronously. If we preserved
|
1090
1090
|
* this behavior in unit testing, we'd have to create async unit tests, which are hard to write,
|
@@ -1094,7 +1094,7 @@ angular.mock.dump = function(object) {
|
|
1094
1094
|
* the async api of the backend, while allowing the test to execute synchronously.
|
1095
1095
|
*
|
1096
1096
|
*
|
1097
|
-
*
|
1097
|
+
* ## Unit testing with mock $httpBackend
|
1098
1098
|
* The following code shows how to setup and use the mock backend when unit testing a controller.
|
1099
1099
|
* First we create the controller under test:
|
1100
1100
|
*
|
@@ -1108,18 +1108,18 @@ angular.mock.dump = function(object) {
|
|
1108
1108
|
function MyController($scope, $http) {
|
1109
1109
|
var authToken;
|
1110
1110
|
|
1111
|
-
$http.get('/auth.py').
|
1112
|
-
authToken = headers('A-Token');
|
1113
|
-
$scope.user = data;
|
1111
|
+
$http.get('/auth.py').then(function(response) {
|
1112
|
+
authToken = response.headers('A-Token');
|
1113
|
+
$scope.user = response.data;
|
1114
1114
|
});
|
1115
1115
|
|
1116
1116
|
$scope.saveMessage = function(message) {
|
1117
1117
|
var headers = { 'Authorization': authToken };
|
1118
1118
|
$scope.status = 'Saving...';
|
1119
1119
|
|
1120
|
-
$http.post('/add-msg.py', message, { headers: headers } ).
|
1120
|
+
$http.post('/add-msg.py', message, { headers: headers } ).then(function(response) {
|
1121
1121
|
$scope.status = '';
|
1122
|
-
}).
|
1122
|
+
}).catch(function() {
|
1123
1123
|
$scope.status = 'Failed...';
|
1124
1124
|
});
|
1125
1125
|
};
|
@@ -1210,7 +1210,87 @@ angular.mock.dump = function(object) {
|
|
1210
1210
|
$httpBackend.flush();
|
1211
1211
|
});
|
1212
1212
|
});
|
1213
|
-
|
1213
|
+
```
|
1214
|
+
*
|
1215
|
+
* ## Dynamic responses
|
1216
|
+
*
|
1217
|
+
* You define a response to a request by chaining a call to `respond()` onto a definition or expectation.
|
1218
|
+
* If you provide a **callback** as the first parameter to `respond(callback)` then you can dynamically generate
|
1219
|
+
* a response based on the properties of the request.
|
1220
|
+
*
|
1221
|
+
* The `callback` function should be of the form `function(method, url, data, headers, params)`.
|
1222
|
+
*
|
1223
|
+
* ### Query parameters
|
1224
|
+
*
|
1225
|
+
* By default, query parameters on request URLs are parsed into the `params` object. So a request URL
|
1226
|
+
* of `/list?q=searchstr&orderby=-name` would set `params` to be `{q: 'searchstr', orderby: '-name'}`.
|
1227
|
+
*
|
1228
|
+
* ### Regex parameter matching
|
1229
|
+
*
|
1230
|
+
* If an expectation or definition uses a **regex** to match the URL, you can provide an array of **keys** via a
|
1231
|
+
* `params` argument. The index of each **key** in the array will match the index of a **group** in the
|
1232
|
+
* **regex**.
|
1233
|
+
*
|
1234
|
+
* The `params` object in the **callback** will now have properties with these keys, which hold the value of the
|
1235
|
+
* corresponding **group** in the **regex**.
|
1236
|
+
*
|
1237
|
+
* This also applies to the `when` and `expect` shortcut methods.
|
1238
|
+
*
|
1239
|
+
*
|
1240
|
+
* ```js
|
1241
|
+
* $httpBackend.expect('GET', /\/user\/(.+)/, undefined, undefined, ['id'])
|
1242
|
+
* .respond(function(method, url, data, headers, params) {
|
1243
|
+
* // for requested url of '/user/1234' params is {id: '1234'}
|
1244
|
+
* });
|
1245
|
+
*
|
1246
|
+
* $httpBackend.whenPATCH(/\/user\/(.+)\/article\/(.+)/, undefined, undefined, ['user', 'article'])
|
1247
|
+
* .respond(function(method, url, data, headers, params) {
|
1248
|
+
* // for url of '/user/1234/article/567' params is {user: '1234', article: '567'}
|
1249
|
+
* });
|
1250
|
+
* ```
|
1251
|
+
*
|
1252
|
+
* ## Matching route requests
|
1253
|
+
*
|
1254
|
+
* For extra convenience, `whenRoute` and `expectRoute` shortcuts are available. These methods offer colon
|
1255
|
+
* delimited matching of the url path, ignoring the query string. This allows declarations
|
1256
|
+
* similar to how application routes are configured with `$routeProvider`. Because these methods convert
|
1257
|
+
* the definition url to regex, declaration order is important. Combined with query parameter parsing,
|
1258
|
+
* the following is possible:
|
1259
|
+
*
|
1260
|
+
```js
|
1261
|
+
$httpBackend.whenRoute('GET', '/users/:id')
|
1262
|
+
.respond(function(method, url, data, headers, params) {
|
1263
|
+
return [200, MockUserList[Number(params.id)]];
|
1264
|
+
});
|
1265
|
+
|
1266
|
+
$httpBackend.whenRoute('GET', '/users')
|
1267
|
+
.respond(function(method, url, data, headers, params) {
|
1268
|
+
var userList = angular.copy(MockUserList),
|
1269
|
+
defaultSort = 'lastName',
|
1270
|
+
count, pages, isPrevious, isNext;
|
1271
|
+
|
1272
|
+
// paged api response '/v1/users?page=2'
|
1273
|
+
params.page = Number(params.page) || 1;
|
1274
|
+
|
1275
|
+
// query for last names '/v1/users?q=Archer'
|
1276
|
+
if (params.q) {
|
1277
|
+
userList = $filter('filter')({lastName: params.q});
|
1278
|
+
}
|
1279
|
+
|
1280
|
+
pages = Math.ceil(userList.length / pagingLength);
|
1281
|
+
isPrevious = params.page > 1;
|
1282
|
+
isNext = params.page < pages;
|
1283
|
+
|
1284
|
+
return [200, {
|
1285
|
+
count: userList.length,
|
1286
|
+
previous: isPrevious,
|
1287
|
+
next: isNext,
|
1288
|
+
// sort field -> '/v1/users?sortBy=firstName'
|
1289
|
+
results: $filter('orderBy')(userList, params.sortBy || defaultSort)
|
1290
|
+
.splice((params.page - 1) * pagingLength, pagingLength)
|
1291
|
+
}];
|
1292
|
+
});
|
1293
|
+
```
|
1214
1294
|
*/
|
1215
1295
|
angular.mock.$HttpBackendProvider = function() {
|
1216
1296
|
this.$get = ['$rootScope', '$timeout', createHttpBackendMock];
|
@@ -1267,7 +1347,7 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) {
|
|
1267
1347
|
return handleResponse;
|
1268
1348
|
|
1269
1349
|
function handleResponse() {
|
1270
|
-
var response = wrapped.response(method, url, data, headers);
|
1350
|
+
var response = wrapped.response(method, url, data, headers, wrapped.params(url));
|
1271
1351
|
xhr.$$respHeaders = response[2];
|
1272
1352
|
callback(copy(response[0]), copy(response[1]), xhr.getAllResponseHeaders(),
|
1273
1353
|
copy(response[3] || ''));
|
@@ -1336,20 +1416,21 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) {
|
|
1336
1416
|
* data string and returns true if the data is as expected.
|
1337
1417
|
* @param {(Object|function(Object))=} headers HTTP headers or function that receives http header
|
1338
1418
|
* object and returns true if the headers match the current definition.
|
1419
|
+
* @param {(Array)=} keys Array of keys to assign to regex matches in request url described above.
|
1339
1420
|
* @returns {requestHandler} Returns an object with `respond` method that controls how a matched
|
1340
1421
|
* request is handled. You can save this object for later use and invoke `respond` again in
|
1341
1422
|
* order to change how a matched request is handled.
|
1342
1423
|
*
|
1343
1424
|
* - respond –
|
1344
1425
|
* `{function([status,] data[, headers, statusText])
|
1345
|
-
* | function(function(method, url, data, headers)}`
|
1426
|
+
* | function(function(method, url, data, headers, params)}`
|
1346
1427
|
* – The respond method takes a set of static data to be returned or a function that can
|
1347
1428
|
* return an array containing response status (number), response data (string), response
|
1348
1429
|
* headers (Object), and the text for the status (string). The respond method returns the
|
1349
1430
|
* `requestHandler` object for possible overrides.
|
1350
1431
|
*/
|
1351
|
-
$httpBackend.when = function(method, url, data, headers) {
|
1352
|
-
var definition = new MockHttpExpectation(method, url, data, headers),
|
1432
|
+
$httpBackend.when = function(method, url, data, headers, keys) {
|
1433
|
+
var definition = new MockHttpExpectation(method, url, data, headers, keys),
|
1353
1434
|
chain = {
|
1354
1435
|
respond: function(status, data, headers, statusText) {
|
1355
1436
|
definition.passThrough = undefined;
|
@@ -1379,6 +1460,7 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) {
|
|
1379
1460
|
* @param {string|RegExp|function(string)} url HTTP url or function that receives a url
|
1380
1461
|
* and returns true if the url matches the current definition.
|
1381
1462
|
* @param {(Object|function(Object))=} headers HTTP headers.
|
1463
|
+
* @param {(Array)=} keys Array of keys to assign to regex matches in request url described above.
|
1382
1464
|
* @returns {requestHandler} Returns an object with `respond` method that controls how a matched
|
1383
1465
|
* request is handled. You can save this object for later use and invoke `respond` again in
|
1384
1466
|
* order to change how a matched request is handled.
|
@@ -1393,6 +1475,7 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) {
|
|
1393
1475
|
* @param {string|RegExp|function(string)} url HTTP url or function that receives a url
|
1394
1476
|
* and returns true if the url matches the current definition.
|
1395
1477
|
* @param {(Object|function(Object))=} headers HTTP headers.
|
1478
|
+
* @param {(Array)=} keys Array of keys to assign to regex matches in request url described above.
|
1396
1479
|
* @returns {requestHandler} Returns an object with `respond` method that controls how a matched
|
1397
1480
|
* request is handled. You can save this object for later use and invoke `respond` again in
|
1398
1481
|
* order to change how a matched request is handled.
|
@@ -1407,6 +1490,7 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) {
|
|
1407
1490
|
* @param {string|RegExp|function(string)} url HTTP url or function that receives a url
|
1408
1491
|
* and returns true if the url matches the current definition.
|
1409
1492
|
* @param {(Object|function(Object))=} headers HTTP headers.
|
1493
|
+
* @param {(Array)=} keys Array of keys to assign to regex matches in request url described above.
|
1410
1494
|
* @returns {requestHandler} Returns an object with `respond` method that controls how a matched
|
1411
1495
|
* request is handled. You can save this object for later use and invoke `respond` again in
|
1412
1496
|
* order to change how a matched request is handled.
|
@@ -1423,6 +1507,7 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) {
|
|
1423
1507
|
* @param {(string|RegExp|function(string))=} data HTTP request body or function that receives
|
1424
1508
|
* data string and returns true if the data is as expected.
|
1425
1509
|
* @param {(Object|function(Object))=} headers HTTP headers.
|
1510
|
+
* @param {(Array)=} keys Array of keys to assign to regex matches in request url described above.
|
1426
1511
|
* @returns {requestHandler} Returns an object with `respond` method that controls how a matched
|
1427
1512
|
* request is handled. You can save this object for later use and invoke `respond` again in
|
1428
1513
|
* order to change how a matched request is handled.
|
@@ -1439,6 +1524,7 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) {
|
|
1439
1524
|
* @param {(string|RegExp|function(string))=} data HTTP request body or function that receives
|
1440
1525
|
* data string and returns true if the data is as expected.
|
1441
1526
|
* @param {(Object|function(Object))=} headers HTTP headers.
|
1527
|
+
* @param {(Array)=} keys Array of keys to assign to regex matches in request url described above.
|
1442
1528
|
* @returns {requestHandler} Returns an object with `respond` method that controls how a matched
|
1443
1529
|
* request is handled. You can save this object for later use and invoke `respond` again in
|
1444
1530
|
* order to change how a matched request is handled.
|
@@ -1452,12 +1538,59 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) {
|
|
1452
1538
|
*
|
1453
1539
|
* @param {string|RegExp|function(string)} url HTTP url or function that receives a url
|
1454
1540
|
* and returns true if the url matches the current definition.
|
1541
|
+
* @param {(Array)=} keys Array of keys to assign to regex matches in request url described above.
|
1455
1542
|
* @returns {requestHandler} Returns an object with `respond` method that controls how a matched
|
1456
1543
|
* request is handled. You can save this object for later use and invoke `respond` again in
|
1457
1544
|
* order to change how a matched request is handled.
|
1458
1545
|
*/
|
1459
1546
|
createShortMethods('when');
|
1460
1547
|
|
1548
|
+
/**
|
1549
|
+
* @ngdoc method
|
1550
|
+
* @name $httpBackend#whenRoute
|
1551
|
+
* @description
|
1552
|
+
* Creates a new backend definition that compares only with the requested route.
|
1553
|
+
*
|
1554
|
+
* @param {string} method HTTP method.
|
1555
|
+
* @param {string} url HTTP url string that supports colon param matching.
|
1556
|
+
* @returns {requestHandler} Returns an object with `respond` method that controls how a matched
|
1557
|
+
* request is handled. You can save this object for later use and invoke `respond` again in
|
1558
|
+
* order to change how a matched request is handled. See #when for more info.
|
1559
|
+
*/
|
1560
|
+
$httpBackend.whenRoute = function(method, url) {
|
1561
|
+
var pathObj = parseRoute(url);
|
1562
|
+
return $httpBackend.when(method, pathObj.regexp, undefined, undefined, pathObj.keys);
|
1563
|
+
};
|
1564
|
+
|
1565
|
+
function parseRoute(url) {
|
1566
|
+
var ret = {
|
1567
|
+
regexp: url
|
1568
|
+
},
|
1569
|
+
keys = ret.keys = [];
|
1570
|
+
|
1571
|
+
if (!url || !angular.isString(url)) return ret;
|
1572
|
+
|
1573
|
+
url = url
|
1574
|
+
.replace(/([().])/g, '\\$1')
|
1575
|
+
.replace(/(\/)?:(\w+)([\?\*])?/g, function(_, slash, key, option) {
|
1576
|
+
var optional = option === '?' ? option : null;
|
1577
|
+
var star = option === '*' ? option : null;
|
1578
|
+
keys.push({ name: key, optional: !!optional });
|
1579
|
+
slash = slash || '';
|
1580
|
+
return ''
|
1581
|
+
+ (optional ? '' : slash)
|
1582
|
+
+ '(?:'
|
1583
|
+
+ (optional ? slash : '')
|
1584
|
+
+ (star && '(.+?)' || '([^/]+)')
|
1585
|
+
+ (optional || '')
|
1586
|
+
+ ')'
|
1587
|
+
+ (optional || '');
|
1588
|
+
})
|
1589
|
+
.replace(/([\/$\*])/g, '\\$1');
|
1590
|
+
|
1591
|
+
ret.regexp = new RegExp('^' + url, 'i');
|
1592
|
+
return ret;
|
1593
|
+
}
|
1461
1594
|
|
1462
1595
|
/**
|
1463
1596
|
* @ngdoc method
|
@@ -1473,20 +1606,21 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) {
|
|
1473
1606
|
* is in JSON format.
|
1474
1607
|
* @param {(Object|function(Object))=} headers HTTP headers or function that receives http header
|
1475
1608
|
* object and returns true if the headers match the current expectation.
|
1609
|
+
* @param {(Array)=} keys Array of keys to assign to regex matches in request url described above.
|
1476
1610
|
* @returns {requestHandler} Returns an object with `respond` method that controls how a matched
|
1477
1611
|
* request is handled. You can save this object for later use and invoke `respond` again in
|
1478
1612
|
* order to change how a matched request is handled.
|
1479
1613
|
*
|
1480
1614
|
* - respond –
|
1481
1615
|
* `{function([status,] data[, headers, statusText])
|
1482
|
-
* | function(function(method, url, data, headers)}`
|
1616
|
+
* | function(function(method, url, data, headers, params)}`
|
1483
1617
|
* – The respond method takes a set of static data to be returned or a function that can
|
1484
1618
|
* return an array containing response status (number), response data (string), response
|
1485
1619
|
* headers (Object), and the text for the status (string). The respond method returns the
|
1486
1620
|
* `requestHandler` object for possible overrides.
|
1487
1621
|
*/
|
1488
|
-
$httpBackend.expect = function(method, url, data, headers) {
|
1489
|
-
var expectation = new MockHttpExpectation(method, url, data, headers),
|
1622
|
+
$httpBackend.expect = function(method, url, data, headers, keys) {
|
1623
|
+
var expectation = new MockHttpExpectation(method, url, data, headers, keys),
|
1490
1624
|
chain = {
|
1491
1625
|
respond: function(status, data, headers, statusText) {
|
1492
1626
|
expectation.response = createResponse(status, data, headers, statusText);
|
@@ -1498,7 +1632,6 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) {
|
|
1498
1632
|
return chain;
|
1499
1633
|
};
|
1500
1634
|
|
1501
|
-
|
1502
1635
|
/**
|
1503
1636
|
* @ngdoc method
|
1504
1637
|
* @name $httpBackend#expectGET
|
@@ -1508,6 +1641,7 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) {
|
|
1508
1641
|
* @param {string|RegExp|function(string)} url HTTP url or function that receives a url
|
1509
1642
|
* and returns true if the url matches the current definition.
|
1510
1643
|
* @param {Object=} headers HTTP headers.
|
1644
|
+
* @param {(Array)=} keys Array of keys to assign to regex matches in request url described above.
|
1511
1645
|
* @returns {requestHandler} Returns an object with `respond` method that controls how a matched
|
1512
1646
|
* request is handled. You can save this object for later use and invoke `respond` again in
|
1513
1647
|
* order to change how a matched request is handled. See #expect for more info.
|
@@ -1522,6 +1656,7 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) {
|
|
1522
1656
|
* @param {string|RegExp|function(string)} url HTTP url or function that receives a url
|
1523
1657
|
* and returns true if the url matches the current definition.
|
1524
1658
|
* @param {Object=} headers HTTP headers.
|
1659
|
+
* @param {(Array)=} keys Array of keys to assign to regex matches in request url described above.
|
1525
1660
|
* @returns {requestHandler} Returns an object with `respond` method that controls how a matched
|
1526
1661
|
* request is handled. You can save this object for later use and invoke `respond` again in
|
1527
1662
|
* order to change how a matched request is handled.
|
@@ -1536,6 +1671,7 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) {
|
|
1536
1671
|
* @param {string|RegExp|function(string)} url HTTP url or function that receives a url
|
1537
1672
|
* and returns true if the url matches the current definition.
|
1538
1673
|
* @param {Object=} headers HTTP headers.
|
1674
|
+
* @param {(Array)=} keys Array of keys to assign to regex matches in request url described above.
|
1539
1675
|
* @returns {requestHandler} Returns an object with `respond` method that controls how a matched
|
1540
1676
|
* request is handled. You can save this object for later use and invoke `respond` again in
|
1541
1677
|
* order to change how a matched request is handled.
|
@@ -1553,6 +1689,7 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) {
|
|
1553
1689
|
* receives data string and returns true if the data is as expected, or Object if request body
|
1554
1690
|
* is in JSON format.
|
1555
1691
|
* @param {Object=} headers HTTP headers.
|
1692
|
+
* @param {(Array)=} keys Array of keys to assign to regex matches in request url described above.
|
1556
1693
|
* @returns {requestHandler} Returns an object with `respond` method that controls how a matched
|
1557
1694
|
* request is handled. You can save this object for later use and invoke `respond` again in
|
1558
1695
|
* order to change how a matched request is handled.
|
@@ -1570,6 +1707,7 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) {
|
|
1570
1707
|
* receives data string and returns true if the data is as expected, or Object if request body
|
1571
1708
|
* is in JSON format.
|
1572
1709
|
* @param {Object=} headers HTTP headers.
|
1710
|
+
* @param {(Array)=} keys Array of keys to assign to regex matches in request url described above.
|
1573
1711
|
* @returns {requestHandler} Returns an object with `respond` method that controls how a matched
|
1574
1712
|
* request is handled. You can save this object for later use and invoke `respond` again in
|
1575
1713
|
* order to change how a matched request is handled.
|
@@ -1587,6 +1725,7 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) {
|
|
1587
1725
|
* receives data string and returns true if the data is as expected, or Object if request body
|
1588
1726
|
* is in JSON format.
|
1589
1727
|
* @param {Object=} headers HTTP headers.
|
1728
|
+
* @param {(Array)=} keys Array of keys to assign to regex matches in request url described above.
|
1590
1729
|
* @returns {requestHandler} Returns an object with `respond` method that controls how a matched
|
1591
1730
|
* request is handled. You can save this object for later use and invoke `respond` again in
|
1592
1731
|
* order to change how a matched request is handled.
|
@@ -1600,12 +1739,30 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) {
|
|
1600
1739
|
*
|
1601
1740
|
* @param {string|RegExp|function(string)} url HTTP url or function that receives an url
|
1602
1741
|
* and returns true if the url matches the current definition.
|
1742
|
+
* @param {(Array)=} keys Array of keys to assign to regex matches in request url described above.
|
1603
1743
|
* @returns {requestHandler} Returns an object with `respond` method that controls how a matched
|
1604
1744
|
* request is handled. You can save this object for later use and invoke `respond` again in
|
1605
1745
|
* order to change how a matched request is handled.
|
1606
1746
|
*/
|
1607
1747
|
createShortMethods('expect');
|
1608
1748
|
|
1749
|
+
/**
|
1750
|
+
* @ngdoc method
|
1751
|
+
* @name $httpBackend#expectRoute
|
1752
|
+
* @description
|
1753
|
+
* Creates a new request expectation that compares only with the requested route.
|
1754
|
+
*
|
1755
|
+
* @param {string} method HTTP method.
|
1756
|
+
* @param {string} url HTTP url string that supports colon param matching.
|
1757
|
+
* @returns {requestHandler} Returns an object with `respond` method that controls how a matched
|
1758
|
+
* request is handled. You can save this object for later use and invoke `respond` again in
|
1759
|
+
* order to change how a matched request is handled. See #expect for more info.
|
1760
|
+
*/
|
1761
|
+
$httpBackend.expectRoute = function(method, url) {
|
1762
|
+
var pathObj = parseRoute(url);
|
1763
|
+
return $httpBackend.expect(method, pathObj.regexp, undefined, undefined, pathObj.keys);
|
1764
|
+
};
|
1765
|
+
|
1609
1766
|
|
1610
1767
|
/**
|
1611
1768
|
* @ngdoc method
|
@@ -1695,20 +1852,20 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) {
|
|
1695
1852
|
|
1696
1853
|
function createShortMethods(prefix) {
|
1697
1854
|
angular.forEach(['GET', 'DELETE', 'JSONP', 'HEAD'], function(method) {
|
1698
|
-
$httpBackend[prefix + method] = function(url, headers) {
|
1699
|
-
return $httpBackend[prefix](method, url, undefined, headers);
|
1855
|
+
$httpBackend[prefix + method] = function(url, headers, keys) {
|
1856
|
+
return $httpBackend[prefix](method, url, undefined, headers, keys);
|
1700
1857
|
};
|
1701
1858
|
});
|
1702
1859
|
|
1703
1860
|
angular.forEach(['PUT', 'POST', 'PATCH'], function(method) {
|
1704
|
-
$httpBackend[prefix + method] = function(url, data, headers) {
|
1705
|
-
return $httpBackend[prefix](method, url, data, headers);
|
1861
|
+
$httpBackend[prefix + method] = function(url, data, headers, keys) {
|
1862
|
+
return $httpBackend[prefix](method, url, data, headers, keys);
|
1706
1863
|
};
|
1707
1864
|
});
|
1708
1865
|
}
|
1709
1866
|
}
|
1710
1867
|
|
1711
|
-
function MockHttpExpectation(method, url, data, headers) {
|
1868
|
+
function MockHttpExpectation(method, url, data, headers, keys) {
|
1712
1869
|
|
1713
1870
|
this.data = data;
|
1714
1871
|
this.headers = headers;
|
@@ -1747,6 +1904,59 @@ function MockHttpExpectation(method, url, data, headers) {
|
|
1747
1904
|
this.toString = function() {
|
1748
1905
|
return method + ' ' + url;
|
1749
1906
|
};
|
1907
|
+
|
1908
|
+
this.params = function(u) {
|
1909
|
+
return angular.extend(parseQuery(), pathParams());
|
1910
|
+
|
1911
|
+
function pathParams() {
|
1912
|
+
var keyObj = {};
|
1913
|
+
if (!url || !angular.isFunction(url.test) || !keys || keys.length === 0) return keyObj;
|
1914
|
+
|
1915
|
+
var m = url.exec(u);
|
1916
|
+
if (!m) return keyObj;
|
1917
|
+
for (var i = 1, len = m.length; i < len; ++i) {
|
1918
|
+
var key = keys[i - 1];
|
1919
|
+
var val = m[i];
|
1920
|
+
if (key && val) {
|
1921
|
+
keyObj[key.name || key] = val;
|
1922
|
+
}
|
1923
|
+
}
|
1924
|
+
|
1925
|
+
return keyObj;
|
1926
|
+
}
|
1927
|
+
|
1928
|
+
function parseQuery() {
|
1929
|
+
var obj = {}, key_value, key,
|
1930
|
+
queryStr = u.indexOf('?') > -1
|
1931
|
+
? u.substring(u.indexOf('?') + 1)
|
1932
|
+
: "";
|
1933
|
+
|
1934
|
+
angular.forEach(queryStr.split('&'), function(keyValue) {
|
1935
|
+
if (keyValue) {
|
1936
|
+
key_value = keyValue.replace(/\+/g,'%20').split('=');
|
1937
|
+
key = tryDecodeURIComponent(key_value[0]);
|
1938
|
+
if (angular.isDefined(key)) {
|
1939
|
+
var val = angular.isDefined(key_value[1]) ? tryDecodeURIComponent(key_value[1]) : true;
|
1940
|
+
if (!hasOwnProperty.call(obj, key)) {
|
1941
|
+
obj[key] = val;
|
1942
|
+
} else if (angular.isArray(obj[key])) {
|
1943
|
+
obj[key].push(val);
|
1944
|
+
} else {
|
1945
|
+
obj[key] = [obj[key],val];
|
1946
|
+
}
|
1947
|
+
}
|
1948
|
+
}
|
1949
|
+
});
|
1950
|
+
return obj;
|
1951
|
+
}
|
1952
|
+
function tryDecodeURIComponent(value) {
|
1953
|
+
try {
|
1954
|
+
return decodeURIComponent(value);
|
1955
|
+
} catch (e) {
|
1956
|
+
// Ignore any invalid uri component
|
1957
|
+
}
|
1958
|
+
}
|
1959
|
+
};
|
1750
1960
|
}
|
1751
1961
|
|
1752
1962
|
function createMockXhr() {
|
@@ -1961,6 +2171,49 @@ angular.mock.$ControllerDecorator = ['$delegate', function($delegate) {
|
|
1961
2171
|
};
|
1962
2172
|
}];
|
1963
2173
|
|
2174
|
+
/**
|
2175
|
+
* @ngdoc service
|
2176
|
+
* @name $componentController
|
2177
|
+
* @description
|
2178
|
+
* A service that can be used to create instances of component controllers.
|
2179
|
+
* <div class="alert alert-info">
|
2180
|
+
* Be aware that the controller will be instantiated and attached to the scope as specified in
|
2181
|
+
* the component definition object. That means that you must always provide a `$scope` object
|
2182
|
+
* in the `locals` param.
|
2183
|
+
* </div>
|
2184
|
+
* @param {string} componentName the name of the component whose controller we want to instantiate
|
2185
|
+
* @param {Object} locals Injection locals for Controller.
|
2186
|
+
* @param {Object=} bindings Properties to add to the controller before invoking the constructor. This is used
|
2187
|
+
* to simulate the `bindToController` feature and simplify certain kinds of tests.
|
2188
|
+
* @param {string=} ident Override the property name to use when attaching the controller to the scope.
|
2189
|
+
* @return {Object} Instance of requested controller.
|
2190
|
+
*/
|
2191
|
+
angular.mock.$ComponentControllerProvider = ['$compileProvider', function($compileProvider) {
|
2192
|
+
return {
|
2193
|
+
$get: ['$controller','$injector', function($controller,$injector) {
|
2194
|
+
return function $componentController(componentName, locals, bindings, ident) {
|
2195
|
+
// get all directives associated to the component name
|
2196
|
+
var directives = $injector.get(componentName + 'Directive');
|
2197
|
+
// look for those directives that are components
|
2198
|
+
var candidateDirectives = directives.filter(function(directiveInfo) {
|
2199
|
+
// components have controller, controllerAs and restrict:'E'
|
2200
|
+
return directiveInfo.controller && directiveInfo.controllerAs && directiveInfo.restrict === 'E';
|
2201
|
+
});
|
2202
|
+
// check if valid directives found
|
2203
|
+
if (candidateDirectives.length === 0) {
|
2204
|
+
throw new Error('No component found');
|
2205
|
+
}
|
2206
|
+
if (candidateDirectives.length > 1) {
|
2207
|
+
throw new Error('Too many components found');
|
2208
|
+
}
|
2209
|
+
// get the info of the component
|
2210
|
+
var directiveInfo = candidateDirectives[0];
|
2211
|
+
return $controller(directiveInfo.controller, locals, bindings, ident || directiveInfo.controllerAs);
|
2212
|
+
};
|
2213
|
+
}]
|
2214
|
+
};
|
2215
|
+
}];
|
2216
|
+
|
1964
2217
|
|
1965
2218
|
/**
|
1966
2219
|
* @ngdoc module
|
@@ -1984,7 +2237,8 @@ angular.module('ngMock', ['ng']).provider({
|
|
1984
2237
|
$log: angular.mock.$LogProvider,
|
1985
2238
|
$interval: angular.mock.$IntervalProvider,
|
1986
2239
|
$httpBackend: angular.mock.$HttpBackendProvider,
|
1987
|
-
$rootElement: angular.mock.$RootElementProvider
|
2240
|
+
$rootElement: angular.mock.$RootElementProvider,
|
2241
|
+
$componentController: angular.mock.$ComponentControllerProvider
|
1988
2242
|
}).config(['$provide', function($provide) {
|
1989
2243
|
$provide.decorator('$timeout', angular.mock.$TimeoutDecorator);
|
1990
2244
|
$provide.decorator('$$rAF', angular.mock.$RAFDecorator);
|
@@ -2071,13 +2325,15 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) {
|
|
2071
2325
|
* @param {(string|RegExp)=} data HTTP request body.
|
2072
2326
|
* @param {(Object|function(Object))=} headers HTTP headers or function that receives http header
|
2073
2327
|
* object and returns true if the headers match the current definition.
|
2328
|
+
* @param {(Array)=} keys Array of keys to assign to regex matches in request url described on
|
2329
|
+
* {@link ngMock.$httpBackend $httpBackend mock}.
|
2074
2330
|
* @returns {requestHandler} Returns an object with `respond` and `passThrough` methods that
|
2075
2331
|
* control how a matched request is handled. You can save this object for later use and invoke
|
2076
2332
|
* `respond` or `passThrough` again in order to change how a matched request is handled.
|
2077
2333
|
*
|
2078
2334
|
* - respond –
|
2079
2335
|
* `{function([status,] data[, headers, statusText])
|
2080
|
-
* | function(function(method, url, data, headers)}`
|
2336
|
+
* | function(function(method, url, data, headers, params)}`
|
2081
2337
|
* – The respond method takes a set of static data to be returned or a function that can return
|
2082
2338
|
* an array containing response status (number), response data (string), response headers
|
2083
2339
|
* (Object), and the text for the status (string).
|
@@ -2097,6 +2353,8 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) {
|
|
2097
2353
|
* @param {string|RegExp|function(string)} url HTTP url or function that receives a url
|
2098
2354
|
* and returns true if the url matches the current definition.
|
2099
2355
|
* @param {(Object|function(Object))=} headers HTTP headers.
|
2356
|
+
* @param {(Array)=} keys Array of keys to assign to regex matches in request url described on
|
2357
|
+
* {@link ngMock.$httpBackend $httpBackend mock}.
|
2100
2358
|
* @returns {requestHandler} Returns an object with `respond` and `passThrough` methods that
|
2101
2359
|
* control how a matched request is handled. You can save this object for later use and invoke
|
2102
2360
|
* `respond` or `passThrough` again in order to change how a matched request is handled.
|
@@ -2112,6 +2370,8 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) {
|
|
2112
2370
|
* @param {string|RegExp|function(string)} url HTTP url or function that receives a url
|
2113
2371
|
* and returns true if the url matches the current definition.
|
2114
2372
|
* @param {(Object|function(Object))=} headers HTTP headers.
|
2373
|
+
* @param {(Array)=} keys Array of keys to assign to regex matches in request url described on
|
2374
|
+
* {@link ngMock.$httpBackend $httpBackend mock}.
|
2115
2375
|
* @returns {requestHandler} Returns an object with `respond` and `passThrough` methods that
|
2116
2376
|
* control how a matched request is handled. You can save this object for later use and invoke
|
2117
2377
|
* `respond` or `passThrough` again in order to change how a matched request is handled.
|
@@ -2127,6 +2387,8 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) {
|
|
2127
2387
|
* @param {string|RegExp|function(string)} url HTTP url or function that receives a url
|
2128
2388
|
* and returns true if the url matches the current definition.
|
2129
2389
|
* @param {(Object|function(Object))=} headers HTTP headers.
|
2390
|
+
* @param {(Array)=} keys Array of keys to assign to regex matches in request url described on
|
2391
|
+
* {@link ngMock.$httpBackend $httpBackend mock}.
|
2130
2392
|
* @returns {requestHandler} Returns an object with `respond` and `passThrough` methods that
|
2131
2393
|
* control how a matched request is handled. You can save this object for later use and invoke
|
2132
2394
|
* `respond` or `passThrough` again in order to change how a matched request is handled.
|
@@ -2143,6 +2405,8 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) {
|
|
2143
2405
|
* and returns true if the url matches the current definition.
|
2144
2406
|
* @param {(string|RegExp)=} data HTTP request body.
|
2145
2407
|
* @param {(Object|function(Object))=} headers HTTP headers.
|
2408
|
+
* @param {(Array)=} keys Array of keys to assign to regex matches in request url described on
|
2409
|
+
* {@link ngMock.$httpBackend $httpBackend mock}.
|
2146
2410
|
* @returns {requestHandler} Returns an object with `respond` and `passThrough` methods that
|
2147
2411
|
* control how a matched request is handled. You can save this object for later use and invoke
|
2148
2412
|
* `respond` or `passThrough` again in order to change how a matched request is handled.
|
@@ -2159,6 +2423,8 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) {
|
|
2159
2423
|
* and returns true if the url matches the current definition.
|
2160
2424
|
* @param {(string|RegExp)=} data HTTP request body.
|
2161
2425
|
* @param {(Object|function(Object))=} headers HTTP headers.
|
2426
|
+
* @param {(Array)=} keys Array of keys to assign to regex matches in request url described on
|
2427
|
+
* {@link ngMock.$httpBackend $httpBackend mock}.
|
2162
2428
|
* @returns {requestHandler} Returns an object with `respond` and `passThrough` methods that
|
2163
2429
|
* control how a matched request is handled. You can save this object for later use and invoke
|
2164
2430
|
* `respond` or `passThrough` again in order to change how a matched request is handled.
|
@@ -2175,6 +2441,8 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) {
|
|
2175
2441
|
* and returns true if the url matches the current definition.
|
2176
2442
|
* @param {(string|RegExp)=} data HTTP request body.
|
2177
2443
|
* @param {(Object|function(Object))=} headers HTTP headers.
|
2444
|
+
* @param {(Array)=} keys Array of keys to assign to regex matches in request url described on
|
2445
|
+
* {@link ngMock.$httpBackend $httpBackend mock}.
|
2178
2446
|
* @returns {requestHandler} Returns an object with `respond` and `passThrough` methods that
|
2179
2447
|
* control how a matched request is handled. You can save this object for later use and invoke
|
2180
2448
|
* `respond` or `passThrough` again in order to change how a matched request is handled.
|
@@ -2189,6 +2457,21 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) {
|
|
2189
2457
|
*
|
2190
2458
|
* @param {string|RegExp|function(string)} url HTTP url or function that receives a url
|
2191
2459
|
* and returns true if the url matches the current definition.
|
2460
|
+
* @param {(Array)=} keys Array of keys to assign to regex matches in request url described on
|
2461
|
+
* {@link ngMock.$httpBackend $httpBackend mock}.
|
2462
|
+
* @returns {requestHandler} Returns an object with `respond` and `passThrough` methods that
|
2463
|
+
* control how a matched request is handled. You can save this object for later use and invoke
|
2464
|
+
* `respond` or `passThrough` again in order to change how a matched request is handled.
|
2465
|
+
*/
|
2466
|
+
/**
|
2467
|
+
* @ngdoc method
|
2468
|
+
* @name $httpBackend#whenRoute
|
2469
|
+
* @module ngMockE2E
|
2470
|
+
* @description
|
2471
|
+
* Creates a new backend definition that compares only with the requested route.
|
2472
|
+
*
|
2473
|
+
* @param {string} method HTTP method.
|
2474
|
+
* @param {string} url HTTP url string that supports colon param matching.
|
2192
2475
|
* @returns {requestHandler} Returns an object with `respond` and `passThrough` methods that
|
2193
2476
|
* control how a matched request is handled. You can save this object for later use and invoke
|
2194
2477
|
* `respond` or `passThrough` again in order to change how a matched request is handled.
|
@@ -2321,10 +2604,12 @@ if (window.jasmine || window.mocha) {
|
|
2321
2604
|
|
2322
2605
|
currentSpec.$injector = null;
|
2323
2606
|
currentSpec.$modules = null;
|
2607
|
+
currentSpec.$providerInjector = null;
|
2324
2608
|
currentSpec = null;
|
2325
2609
|
|
2326
2610
|
if (injector) {
|
2327
2611
|
injector.get('$rootElement').off();
|
2612
|
+
injector.get('$rootScope').$destroy();
|
2328
2613
|
}
|
2329
2614
|
|
2330
2615
|
// clean up jquery's fragment cache
|
@@ -2368,16 +2653,21 @@ if (window.jasmine || window.mocha) {
|
|
2368
2653
|
if (currentSpec.$injector) {
|
2369
2654
|
throw new Error('Injector already created, can not register a module!');
|
2370
2655
|
} else {
|
2371
|
-
var modules = currentSpec.$modules || (currentSpec.$modules = []);
|
2656
|
+
var fn, modules = currentSpec.$modules || (currentSpec.$modules = []);
|
2372
2657
|
angular.forEach(moduleFns, function(module) {
|
2373
2658
|
if (angular.isObject(module) && !angular.isArray(module)) {
|
2374
|
-
|
2659
|
+
fn = function($provide) {
|
2375
2660
|
angular.forEach(module, function(value, key) {
|
2376
2661
|
$provide.value(key, value);
|
2377
2662
|
});
|
2378
|
-
}
|
2663
|
+
};
|
2379
2664
|
} else {
|
2380
|
-
|
2665
|
+
fn = module;
|
2666
|
+
}
|
2667
|
+
if (currentSpec.$providerInjector) {
|
2668
|
+
currentSpec.$providerInjector.invoke(fn);
|
2669
|
+
} else {
|
2670
|
+
modules.push(fn);
|
2381
2671
|
}
|
2382
2672
|
});
|
2383
2673
|
}
|
@@ -2491,6 +2781,9 @@ if (window.jasmine || window.mocha) {
|
|
2491
2781
|
function workFn() {
|
2492
2782
|
var modules = currentSpec.$modules || [];
|
2493
2783
|
var strictDi = !!currentSpec.$injectorStrict;
|
2784
|
+
modules.unshift(function($injector) {
|
2785
|
+
currentSpec.$providerInjector = $injector;
|
2786
|
+
});
|
2494
2787
|
modules.unshift('ngMock');
|
2495
2788
|
modules.unshift('ng');
|
2496
2789
|
var injector = currentSpec.$injector;
|