vendor/assets/javascripts/angular-mocks.js in angularjs-rails-1.2.15 vs vendor/assets/javascripts/angular-mocks.js in angularjs-rails-1.2.16
- old
+ new
@@ -1,7 +1,7 @@
/**
- * @license AngularJS v1.2.15
+ * @license AngularJS v1.2.16
* (c) 2010-2014 Google, Inc. http://angularjs.org
* License: MIT
*/
(function(window, angular, undefined) {
@@ -1095,16 +1095,16 @@
expectations = [],
responses = [],
responsesPush = angular.bind(responses, responses.push),
copy = angular.copy;
- function createResponse(status, data, headers) {
+ function createResponse(status, data, headers, statusText) {
if (angular.isFunction(status)) return status;
return function() {
return angular.isNumber(status)
- ? [status, data, headers]
+ ? [status, data, headers, statusText]
: [200, status, data];
};
}
// TODO(vojta): change params to: method, url, data, headers, callback
@@ -1125,11 +1125,12 @@
return handleResponse;
function handleResponse() {
var response = wrapped.response(method, url, data, headers);
xhr.$$respHeaders = response[2];
- callback(copy(response[0]), copy(response[1]), xhr.getAllResponseHeaders());
+ callback(copy(response[0]), copy(response[1]), xhr.getAllResponseHeaders(),
+ copy(response[3] || ''));
}
function handleTimeout() {
for (var i = 0, ii = responses.length; i < ii; i++) {
if (responses[i] === handleResponse) {
@@ -1192,20 +1193,21 @@
* object and returns true if the headers match the current definition.
* @returns {requestHandler} Returns an object with `respond` method that controls how a matched
* request is handled.
*
* - respond –
- * `{function([status,] data[, headers])|function(function(method, url, data, headers)}`
- * – The respond method takes a set of static data to be returned or a function that can return
- * an array containing response status (number), response data (string) and response headers
- * (Object).
+ * `{function([status,] data[, headers, statusText])
+ * | function(function(method, url, data, headers)}`
+ * – The respond method takes a set of static data to be returned or a function that can
+ * return an array containing response status (number), response data (string), response
+ * headers (Object), and the text for the status (string).
*/
$httpBackend.when = function(method, url, data, headers) {
var definition = new MockHttpExpectation(method, url, data, headers),
chain = {
- respond: function(status, data, headers) {
- definition.response = createResponse(status, data, headers);
+ respond: function(status, data, headers, statusText) {
+ definition.response = createResponse(status, data, headers, statusText);
}
};
if ($browser) {
chain.passThrough = function() {
@@ -1309,21 +1311,22 @@
* object and returns true if the headers match the current expectation.
* @returns {requestHandler} Returns an object with `respond` method that control how a matched
* request is handled.
*
* - respond –
- * `{function([status,] data[, headers])|function(function(method, url, data, headers)}`
- * – The respond method takes a set of static data to be returned or a function that can return
- * an array containing response status (number), response data (string) and response headers
- * (Object).
+ * `{function([status,] data[, headers, statusText])
+ * | function(function(method, url, data, headers)}`
+ * – The respond method takes a set of static data to be returned or a function that can
+ * return an array containing response status (number), response data (string), response
+ * headers (Object), and the text for the status (string).
*/
$httpBackend.expect = function(method, url, data, headers) {
var expectation = new MockHttpExpectation(method, url, data, headers);
expectations.push(expectation);
return {
- respond: function(status, data, headers) {
- expectation.response = createResponse(status, data, headers);
+ respond: function (status, data, headers, statusText) {
+ expectation.response = createResponse(status, data, headers, statusText);
}
};
};
@@ -1821,16 +1824,17 @@
* object and returns true if the headers match the current definition.
* @returns {requestHandler} Returns an object with `respond` and `passThrough` methods that
* control how a matched request is handled.
*
* - respond –
- * `{function([status,] data[, headers])|function(function(method, url, data, headers)}`
+ * `{function([status,] data[, headers, statusText])
+ * | function(function(method, url, data, headers)}`
* – The respond method takes a set of static data to be returned or a function that can return
- * an array containing response status (number), response data (string) and response headers
- * (Object).
- * - passThrough – `{function()}` – Any request matching a backend definition with `passThrough`
- * handler will be passed through to the real backend (an XHR request will be made to the
- * server.)
+ * an array containing response status (number), response data (string), response headers
+ * (Object), and the text for the status (string).
+ * - passThrough – `{function()}` – Any request matching a backend definition with
+ * `passThrough` handler will be passed through to the real backend (an XHR request will be made
+ * to the server.)
*/
/**
* @ngdoc method
* @name $httpBackend#whenGET