mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-15 10:13:10 +00:00
Edited the 'Flushing HTTP requests' section
Minor grammatical edits in the Flushing HTTP requests section.
This commit is contained in:
parent
caed2dfe4f
commit
29432ffe37
1 changed files with 7 additions and 7 deletions
14
src/ngMock/angular-mocks.js
vendored
14
src/ngMock/angular-mocks.js
vendored
|
|
@ -989,18 +989,18 @@ angular.mock.dump = function(object) {
|
||||||
*
|
*
|
||||||
* # Flushing HTTP requests
|
* # Flushing HTTP requests
|
||||||
*
|
*
|
||||||
* The $httpBackend used in production, always responds to requests with responses asynchronously.
|
* The $httpBackend used in production always responds to requests with responses asynchronously.
|
||||||
* If we preserved this behavior in unit testing, we'd have to create async unit tests, which are
|
* If we preserved this behavior in unit testing we'd have to create async unit tests, which are
|
||||||
* hard to write, follow and maintain. At the same time the testing mock, can't respond
|
* hard to write, understand, and maintain. However, the testing mock can't respond
|
||||||
* synchronously because that would change the execution of the code under test. For this reason the
|
* synchronously because that would change the execution of the code under test. For this reason the
|
||||||
* mock $httpBackend has a `flush()` method, which allows the test to explicitly flush pending
|
* mock $httpBackend has a `flush()` method, which allows the test to explicitly flush pending
|
||||||
* requests and thus preserving the async api of the backend, while allowing the test to execute
|
* requests and thus preserve the async api of the backend while allowing the test to execute
|
||||||
* synchronously.
|
* synchronously.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* # Unit testing with mock $httpBackend
|
* # Unit testing with mock $httpBackend
|
||||||
* The following code shows how to setup and use the mock backend in unit testing a controller.
|
* The following code shows how to setup and use the mock backend when unit testing a controller.
|
||||||
* First we create the controller under test
|
* First we create the controller under test:
|
||||||
*
|
*
|
||||||
<pre>
|
<pre>
|
||||||
// The controller code
|
// The controller code
|
||||||
|
|
@ -1025,7 +1025,7 @@ angular.mock.dump = function(object) {
|
||||||
}
|
}
|
||||||
</pre>
|
</pre>
|
||||||
*
|
*
|
||||||
* Now we setup the mock backend and create the test specs.
|
* Now we setup the mock backend and create the test specs:
|
||||||
*
|
*
|
||||||
<pre>
|
<pre>
|
||||||
// testing controller
|
// testing controller
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue