mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-11 10:59:24 +08:00
docs(ngMock): fixes in flush() documentation
The docs for the `flush()` method contained a few grammatical errors and were awkwardly worded. Change the explanation of the method to remove errors and read more naturally. Closes #4886
This commit is contained in:
committed by
Pawel Kozlowski
parent
3a8bbb721d
commit
3248233f5e
13
src/ngMock/angular-mocks.js
vendored
13
src/ngMock/angular-mocks.js
vendored
@@ -960,13 +960,12 @@ angular.mock.dump = function(object) {
|
||||
*
|
||||
* # Flushing HTTP requests
|
||||
*
|
||||
* 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
|
||||
* 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
|
||||
* mock $httpBackend has a `flush()` method, which allows the test to explicitly flush pending
|
||||
* requests and thus preserve the async api of the backend while allowing the test to execute
|
||||
* synchronously.
|
||||
* The $httpBackend used in production always responds to requests asynchronously. If we preserved
|
||||
* this behavior in unit testing, we'd have to create async unit tests, which are hard to write,
|
||||
* to follow and to maintain. But neither can the testing mock respond synchronously; 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 requests. This preserves
|
||||
* the async api of the backend, while allowing the test to execute synchronously.
|
||||
*
|
||||
*
|
||||
* # Unit testing with mock $httpBackend
|
||||
|
||||
Reference in New Issue
Block a user