feat(fakeAsync): flush the microtasks before returning

fixes #2269
This commit is contained in:
Victor Berchet
2015-06-02 19:55:03 +02:00
parent ec3a78289f
commit c7572ac1f9
3 changed files with 21 additions and 3 deletions
@@ -46,6 +46,18 @@ export function main() {
});
}
it('should flush microtasks before returning', () => {
var thenRan = false;
fakeAsync(() => { PromiseWrapper.resolve(null).then(_ => { thenRan = true; }); })();
expect(thenRan).toEqual(true);
});
it('should propagate the return value',
() => { expect(fakeAsync(() => 'foo')()).toEqual('foo'); });
describe('Promise', () => {
it('should run asynchronous code', fakeAsync(() => {
var thenRan = false;