2017-02-24 00:23:57 -05:00
|
|
|
/**
|
|
|
|
* @license
|
2020-05-19 15:08:49 -04:00
|
|
|
* Copyright Google LLC All Rights Reserved.
|
2017-02-24 00:23:57 -05:00
|
|
|
*
|
|
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
|
|
* found in the LICENSE file at https://angular.io/license
|
|
|
|
*/
|
|
|
|
import {scheduleMicroTask} from '../src/util';
|
|
|
|
|
2017-12-16 17:42:55 -05:00
|
|
|
{
|
2017-02-24 00:23:57 -05:00
|
|
|
describe('util', () => {
|
|
|
|
it('should schedule a microtask and not call an async timeout', (done) => {
|
|
|
|
let count = 0;
|
|
|
|
scheduleMicroTask(() => count++);
|
|
|
|
|
|
|
|
expect(count).toEqual(0);
|
|
|
|
Promise.resolve(null).then(() => {
|
|
|
|
expect(count).toEqual(1);
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
expect(count).toEqual(0);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|