@@ -257,6 +257,38 @@ and/or `beforeRemoveClass` then the CSS classes will not be applied
257257in time for the children (and the parent class-based animation will not
258258be cancelled by any child animations).
259259
260+ - **$q** due to [6838c979](https://github.com/angular/angular.js/commit/6838c979451c109d959a15035177ccee715ccf19),
261+ When writting tests, there is no need to call `$timeout.flush()` to resolve a call to `$q.when` with a value.
262+
263+ The previous behavior involve creating an extra promise that needed to be resolved. This is no longer needed when
264+ `$q.when` is called with a value. In the case that the test is not aware if `$q.when` is called with a value or
265+ another promise, it is possible to replace `$timeout.flush();` with `$timeout.flush(0);`.
266+
267+ ```js
268+ describe('$q.when', function() {
269+ it('should not need a call to $timeout.flush() to resolve already resolved promises',
270+ inject(function($q, $timeout) {
271+ $q.when('foo');
272+ // In Angular 1.4.3 a call to `$timeout.flush();` was needed
273+ $timeout.verifyNoPendingTasks();
274+ }));
275+
276+ it('should accept $timeout.flush(0) when not sure if $q.when was called with a value or a promise’,
277+ inject(function($q, $timeout) {
278+ $q.when('foo');
279+ $timeout.flush(0);
280+ $timeout.verifyNoPendingTasks();
281+ }));
282+
283+ it('should need a call to $timeout.flush() to resolve $q.when when called with a promise',
284+ inject(function($q, $timeout) {
285+ $q.when($q.when('foo'));
286+ $timeout.flush();
287+ $timeout.verifyNoPendingTasks();
288+ }));
289+ });
290+ ```
291+
260292
261293<a name="1.4.3"></a>
262294# 1.4.3 foam-acceleration (2015-07-15)
0 commit comments