Upgrade to angularjs 1.2.0 rc1

This commit is contained in:
Colin Frei 2013-08-21 19:46:51 +02:00
parent d223dfd662
commit d6b021bfaf
674 changed files with 79667 additions and 62269 deletions

176
lib/angular/docs/partials/api/ngMockE2E.$httpBackend.html Normal file → Executable file
View file

@ -1,32 +1,27 @@
<h1><code ng:non-bindable="">$httpBackend</code>
<span class="hint">(service in module <code ng:non-bindable="">ngMockE2E</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/ngMock/angular-mocks.js#L1619" class="view-source btn btn-action"><i class="icon-zoom-in"> </i> View source</a><a href="http://github.com/angular/angular.js/edit/master/src/ngMock/angular-mocks.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">$httpBackend</code>
<div><span class="hint">service in module <code ng:non-bindable="">ngMockE2E</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/ngMock/angular-mocks.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>Fake HTTP backend implementation suitable for end-to-end testing or backend-less development of
<div><h2 id="Description">Description</h2>
<div class="description"><div class="ngmocke2e-httpbackend-page"><p>Fake HTTP backend implementation suitable for end-to-end testing or backend-less development of
applications that use the <a href="api/ng.$http"><code>$http service</code></a>.</p>
<p><em>Note</em>: For fake http backend implementation suitable for unit testing please see
<a href="api/ngMock.$httpBackend">unit-testing $httpBackend mock</a>.</p>
<p>This implementation can be used to respond with static or dynamic responses via the <code>when</code> api
and its shortcuts (<code>whenGET</code>, <code>whenPOST</code>, etc) and optionally pass through requests to the
real $httpBackend for specific requests (e.g. to interact with certain remote apis or to fetch
templates from a webserver).</p>
<p>As opposed to unit-testing, in an end-to-end testing scenario or in scenario when an application
is being developed with the real backend api replaced with a mock, it is often desirable for
certain category of requests to bypass the mock and issue a real http request (e.g. to fetch
templates or static files from the webserver). To configure the backend with this behavior
use the <code>passThrough</code> request handler of <code>when</code> instead of <code>respond</code>.</p>
<p>Additionally, we don't want to manually have to flush mocked out requests like we do during unit
<p>Additionally, we don&#39;t want to manually have to flush mocked out requests like we do during unit
testing. For this reason the e2e $httpBackend automatically flushes mocked out requests
automatically, closely simulating the behavior of the XMLHttpRequest object.</p>
<p>To setup the application to run with this http backend, you have to create a module that depends
on the <code>ngMockE2E</code> and your application modules and defines the fake backend:</p>
<pre class="prettyprint linenums">
myAppDev = angular.module('myAppDev', ['myApp', 'ngMockE2E']);
myAppDev.run(function($httpBackend) {
@ -37,32 +32,24 @@ on the <code>ngMockE2E</code> and your application modules and defines the fake
// adds a new phone to the phones array
$httpBackend.whenPOST('/phones').respond(function(method, url, data) {
phones.push(angular.fromJSON(data));
phones.push(angular.fromJson(data));
});
$httpBackend.whenGET(/^\/templates\//).passThrough();
//...
});
</pre>
<p>Afterwards, bootstrap your app with this new module.</p></div>
<p>Afterwards, bootstrap your app with this new module.</p>
</div></div>
<div class="member method"><h2 id="Methods">Methods</h2>
<ul class="methods"><li><h3 id="when">when(method, url, data, headers)</h3>
<div class="when"><p>Creates a new backend definition.</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">method {string} </code>
<p>HTTP method.</p></li>
<li><code ng:non-bindable="">url {string|RegExp} </code>
<p>HTTP url.</p></li>
<li><code ng:non-bindable="">data<i>(optional)</i> {(string|RegExp)=} </code>
<p>HTTP request body.</p></li>
<li><code ng:non-bindable="">headers<i>(optional)</i> {(Object|function(Object))=} </code>
<p>HTTP headers or function that receives http header
object and returns true if the headers match the current definition.</p></li>
</ul>
<h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{requestHandler}</code>
<p>Returns an object with <code>respond</code> and <code>passThrough</code> methods that
<div class="when"><div class="ngmocke2e-httpbackend-when-page"><p>Creates a new backend definition.</p>
</div><h5 id="parameters">Parameters</h5><table class="variables-matrix table table-bordered table-striped"><thead><tr><th>Param</th><th>Type</th><th>Details</th></tr></thead><tbody><tr><td>method</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ngmocke2e-httpbackend-when-page"><p>HTTP method.</p>
</div></td></tr><tr><td>url</td><td><a href="" class="label type-hint type-hint-string">string</a><a href="" class="label type-hint type-hint-regexp">RegExp</a></td><td><div class="ngmocke2e-httpbackend-when-page"><p>HTTP url.</p>
</div></td></tr><tr><td>data <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-string">string</a><a href="" class="label type-hint type-hint-regexp">RegExp</a></td><td><div class="ngmocke2e-httpbackend-when-page"><p>HTTP request body.</p>
</div></td></tr><tr><td>headers <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-object">Object</a><a href="" class="label type-hint type-hint-function">function(Object)</a></td><td><div class="ngmocke2e-httpbackend-when-page"><p>HTTP headers or function that receives http header
object and returns true if the headers match the current definition.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-requesthandler">requestHandler</a></td><td><div class="ngmocke2e-httpbackend-when-page"><p>Returns an object with <code>respond</code> and <code>passThrough</code> methods that
control how a matched request is handled.</p>
<ul>
<li>respond <code>{function([status,] data[, headers])|function(function(method, url, data, headers)}</code>
The respond method takes a set of static data to be returned or a function that can return
@ -71,103 +58,66 @@ an array containing response status (number), response data (string) and respons
<li>passThrough <code>{function()}</code> Any request matching a backend definition with <code>passThrough</code>
handler, will be pass through to the real backend (an XHR request will be made to the
server.</li>
</ul></div>
</div>
</ul>
</div></td></tr></table></div>
</li>
<li><h3 id="whenDELETE">whenDELETE(url, headers)</h3>
<div class="whendelete"><p>Creates a new backend definition for DELETE requests. For more info see <code>when()</code>.</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">url {string|RegExp} </code>
<p>HTTP url.</p></li>
<li><code ng:non-bindable="">headers<i>(optional)</i> {(Object|function(Object))=} </code>
<p>HTTP headers.</p></li>
</ul>
<h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{requestHandler}</code>
<p>Returns an object with <code>respond</code> and <code>passThrough</code> methods that
control how a matched request is handled.</p></div>
</div>
<div class="whendelete"><div class="ngmocke2e-httpbackend-whendelete-page"><p>Creates a new backend definition for DELETE requests. For more info see <code>when()</code>.</p>
</div><h5 id="parameters">Parameters</h5><table class="variables-matrix table table-bordered table-striped"><thead><tr><th>Param</th><th>Type</th><th>Details</th></tr></thead><tbody><tr><td>url</td><td><a href="" class="label type-hint type-hint-string">string</a><a href="" class="label type-hint type-hint-regexp">RegExp</a></td><td><div class="ngmocke2e-httpbackend-whendelete-page"><p>HTTP url.</p>
</div></td></tr><tr><td>headers <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-object">Object</a><a href="" class="label type-hint type-hint-function">function(Object)</a></td><td><div class="ngmocke2e-httpbackend-whendelete-page"><p>HTTP headers.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-requesthandler">requestHandler</a></td><td><div class="ngmocke2e-httpbackend-whendelete-page"><p>Returns an object with <code>respond</code> and <code>passThrough</code> methods that
control how a matched request is handled.</p>
</div></td></tr></table></div>
</li>
<li><h3 id="whenGET">whenGET(url, headers)</h3>
<div class="whenget"><p>Creates a new backend definition for GET requests. For more info see <code>when()</code>.</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">url {string|RegExp} </code>
<p>HTTP url.</p></li>
<li><code ng:non-bindable="">headers<i>(optional)</i> {(Object|function(Object))=} </code>
<p>HTTP headers.</p></li>
</ul>
<h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{requestHandler}</code>
<p>Returns an object with <code>respond</code> and <code>passThrough</code> methods that
control how a matched request is handled.</p></div>
</div>
<div class="whenget"><div class="ngmocke2e-httpbackend-whenget-page"><p>Creates a new backend definition for GET requests. For more info see <code>when()</code>.</p>
</div><h5 id="parameters">Parameters</h5><table class="variables-matrix table table-bordered table-striped"><thead><tr><th>Param</th><th>Type</th><th>Details</th></tr></thead><tbody><tr><td>url</td><td><a href="" class="label type-hint type-hint-string">string</a><a href="" class="label type-hint type-hint-regexp">RegExp</a></td><td><div class="ngmocke2e-httpbackend-whenget-page"><p>HTTP url.</p>
</div></td></tr><tr><td>headers <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-object">Object</a><a href="" class="label type-hint type-hint-function">function(Object)</a></td><td><div class="ngmocke2e-httpbackend-whenget-page"><p>HTTP headers.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-requesthandler">requestHandler</a></td><td><div class="ngmocke2e-httpbackend-whenget-page"><p>Returns an object with <code>respond</code> and <code>passThrough</code> methods that
control how a matched request is handled.</p>
</div></td></tr></table></div>
</li>
<li><h3 id="whenHEAD">whenHEAD(url, headers)</h3>
<div class="whenhead"><p>Creates a new backend definition for HEAD requests. For more info see <code>when()</code>.</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">url {string|RegExp} </code>
<p>HTTP url.</p></li>
<li><code ng:non-bindable="">headers<i>(optional)</i> {(Object|function(Object))=} </code>
<p>HTTP headers.</p></li>
</ul>
<h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{requestHandler}</code>
<p>Returns an object with <code>respond</code> and <code>passThrough</code> methods that
control how a matched request is handled.</p></div>
</div>
<div class="whenhead"><div class="ngmocke2e-httpbackend-whenhead-page"><p>Creates a new backend definition for HEAD requests. For more info see <code>when()</code>.</p>
</div><h5 id="parameters">Parameters</h5><table class="variables-matrix table table-bordered table-striped"><thead><tr><th>Param</th><th>Type</th><th>Details</th></tr></thead><tbody><tr><td>url</td><td><a href="" class="label type-hint type-hint-string">string</a><a href="" class="label type-hint type-hint-regexp">RegExp</a></td><td><div class="ngmocke2e-httpbackend-whenhead-page"><p>HTTP url.</p>
</div></td></tr><tr><td>headers <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-object">Object</a><a href="" class="label type-hint type-hint-function">function(Object)</a></td><td><div class="ngmocke2e-httpbackend-whenhead-page"><p>HTTP headers.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-requesthandler">requestHandler</a></td><td><div class="ngmocke2e-httpbackend-whenhead-page"><p>Returns an object with <code>respond</code> and <code>passThrough</code> methods that
control how a matched request is handled.</p>
</div></td></tr></table></div>
</li>
<li><h3 id="whenJSONP">whenJSONP(url)</h3>
<div class="whenjsonp"><p>Creates a new backend definition for JSONP requests. For more info see <code>when()</code>.</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">url {string|RegExp} </code>
<p>HTTP url.</p></li>
</ul>
<h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{requestHandler}</code>
<p>Returns an object with <code>respond</code> and <code>passThrough</code> methods that
control how a matched request is handled.</p></div>
</div>
<div class="whenjsonp"><div class="ngmocke2e-httpbackend-whenjsonp-page"><p>Creates a new backend definition for JSONP requests. For more info see <code>when()</code>.</p>
</div><h5 id="parameters">Parameters</h5><table class="variables-matrix table table-bordered table-striped"><thead><tr><th>Param</th><th>Type</th><th>Details</th></tr></thead><tbody><tr><td>url</td><td><a href="" class="label type-hint type-hint-string">string</a><a href="" class="label type-hint type-hint-regexp">RegExp</a></td><td><div class="ngmocke2e-httpbackend-whenjsonp-page"><p>HTTP url.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-requesthandler">requestHandler</a></td><td><div class="ngmocke2e-httpbackend-whenjsonp-page"><p>Returns an object with <code>respond</code> and <code>passThrough</code> methods that
control how a matched request is handled.</p>
</div></td></tr></table></div>
</li>
<li><h3 id="whenPATCH">whenPATCH(url, data, headers)</h3>
<div class="whenpatch"><p>Creates a new backend definition for PATCH requests. For more info see <code>when()</code>.</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">url {string|RegExp} </code>
<p>HTTP url.</p></li>
<li><code ng:non-bindable="">data<i>(optional)</i> {(string|RegExp)=} </code>
<p>HTTP request body.</p></li>
<li><code ng:non-bindable="">headers<i>(optional)</i> {(Object|function(Object))=} </code>
<p>HTTP headers.</p></li>
</ul>
<h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{requestHandler}</code>
<p>Returns an object with <code>respond</code> and <code>passThrough</code> methods that
control how a matched request is handled.</p></div>
</div>
<div class="whenpatch"><div class="ngmocke2e-httpbackend-whenpatch-page"><p>Creates a new backend definition for PATCH requests. For more info see <code>when()</code>.</p>
</div><h5 id="parameters">Parameters</h5><table class="variables-matrix table table-bordered table-striped"><thead><tr><th>Param</th><th>Type</th><th>Details</th></tr></thead><tbody><tr><td>url</td><td><a href="" class="label type-hint type-hint-string">string</a><a href="" class="label type-hint type-hint-regexp">RegExp</a></td><td><div class="ngmocke2e-httpbackend-whenpatch-page"><p>HTTP url.</p>
</div></td></tr><tr><td>data <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-string">string</a><a href="" class="label type-hint type-hint-regexp">RegExp</a></td><td><div class="ngmocke2e-httpbackend-whenpatch-page"><p>HTTP request body.</p>
</div></td></tr><tr><td>headers <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-object">Object</a><a href="" class="label type-hint type-hint-function">function(Object)</a></td><td><div class="ngmocke2e-httpbackend-whenpatch-page"><p>HTTP headers.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-requesthandler">requestHandler</a></td><td><div class="ngmocke2e-httpbackend-whenpatch-page"><p>Returns an object with <code>respond</code> and <code>passThrough</code> methods that
control how a matched request is handled.</p>
</div></td></tr></table></div>
</li>
<li><h3 id="whenPOST">whenPOST(url, data, headers)</h3>
<div class="whenpost"><p>Creates a new backend definition for POST requests. For more info see <code>when()</code>.</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">url {string|RegExp} </code>
<p>HTTP url.</p></li>
<li><code ng:non-bindable="">data<i>(optional)</i> {(string|RegExp)=} </code>
<p>HTTP request body.</p></li>
<li><code ng:non-bindable="">headers<i>(optional)</i> {(Object|function(Object))=} </code>
<p>HTTP headers.</p></li>
</ul>
<h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{requestHandler}</code>
<p>Returns an object with <code>respond</code> and <code>passThrough</code> methods that
control how a matched request is handled.</p></div>
</div>
<div class="whenpost"><div class="ngmocke2e-httpbackend-whenpost-page"><p>Creates a new backend definition for POST requests. For more info see <code>when()</code>.</p>
</div><h5 id="parameters">Parameters</h5><table class="variables-matrix table table-bordered table-striped"><thead><tr><th>Param</th><th>Type</th><th>Details</th></tr></thead><tbody><tr><td>url</td><td><a href="" class="label type-hint type-hint-string">string</a><a href="" class="label type-hint type-hint-regexp">RegExp</a></td><td><div class="ngmocke2e-httpbackend-whenpost-page"><p>HTTP url.</p>
</div></td></tr><tr><td>data <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-string">string</a><a href="" class="label type-hint type-hint-regexp">RegExp</a></td><td><div class="ngmocke2e-httpbackend-whenpost-page"><p>HTTP request body.</p>
</div></td></tr><tr><td>headers <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-object">Object</a><a href="" class="label type-hint type-hint-function">function(Object)</a></td><td><div class="ngmocke2e-httpbackend-whenpost-page"><p>HTTP headers.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-requesthandler">requestHandler</a></td><td><div class="ngmocke2e-httpbackend-whenpost-page"><p>Returns an object with <code>respond</code> and <code>passThrough</code> methods that
control how a matched request is handled.</p>
</div></td></tr></table></div>
</li>
<li><h3 id="whenPUT">whenPUT(url, data, headers)</h3>
<div class="whenput"><p>Creates a new backend definition for PUT requests. For more info see <code>when()</code>.</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">url {string|RegExp} </code>
<p>HTTP url.</p></li>
<li><code ng:non-bindable="">data<i>(optional)</i> {(string|RegExp)=} </code>
<p>HTTP request body.</p></li>
<li><code ng:non-bindable="">headers<i>(optional)</i> {(Object|function(Object))=} </code>
<p>HTTP headers.</p></li>
</ul>
<h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{requestHandler}</code>
<p>Returns an object with <code>respond</code> and <code>passThrough</code> methods that
control how a matched request is handled.</p></div>
</div>
<div class="whenput"><div class="ngmocke2e-httpbackend-whenput-page"><p>Creates a new backend definition for PUT requests. For more info see <code>when()</code>.</p>
</div><h5 id="parameters">Parameters</h5><table class="variables-matrix table table-bordered table-striped"><thead><tr><th>Param</th><th>Type</th><th>Details</th></tr></thead><tbody><tr><td>url</td><td><a href="" class="label type-hint type-hint-string">string</a><a href="" class="label type-hint type-hint-regexp">RegExp</a></td><td><div class="ngmocke2e-httpbackend-whenput-page"><p>HTTP url.</p>
</div></td></tr><tr><td>data <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-string">string</a><a href="" class="label type-hint type-hint-regexp">RegExp</a></td><td><div class="ngmocke2e-httpbackend-whenput-page"><p>HTTP request body.</p>
</div></td></tr><tr><td>headers <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-object">Object</a><a href="" class="label type-hint type-hint-function">function(Object)</a></td><td><div class="ngmocke2e-httpbackend-whenput-page"><p>HTTP headers.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-requesthandler">requestHandler</a></td><td><div class="ngmocke2e-httpbackend-whenput-page"><p>Returns an object with <code>respond</code> and <code>passThrough</code> methods that
control how a matched request is handled.</p>
</div></td></tr></table></div>
</li>
</ul>
</div>