MCPcopy Create free account
hub / github.com/angular/angular / commonTests

Function commonTests

packages/core/test/zone/ng_zone_spec.ts:232–1363  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

230});
231
232function commonTests() {
233 describe('hasPendingMicrotasks', () => {
234 it('should be false', () => {
235 expect(_zone.hasPendingMicrotasks).toBe(false);
236 });
237
238 it('should be true', () => {
239 runNgZoneNoLog(() => {
240 queueMicrotask(() => {});
241 });
242 expect(_zone.hasPendingMicrotasks).toBe(true);
243 });
244 });
245
246 describe('hasPendingTimers', () => {
247 it('should be false', () => {
248 expect(_zone.hasPendingMacrotasks).toBe(false);
249 });
250
251 it('should be true', () => {
252 runNgZoneNoLog(() => {
253 setTimeout(() => {}, 0);
254 });
255 expect(_zone.hasPendingMacrotasks).toBe(true);
256 });
257 });
258
259 describe('hasPendingAsyncTasks', () => {
260 it('should be false', () => {
261 expect(_zone.hasPendingMicrotasks).toBe(false);
262 });
263
264 it('should be true when microtask is scheduled', () => {
265 runNgZoneNoLog(() => {
266 queueMicrotask(() => {});
267 });
268 expect(_zone.hasPendingMicrotasks).toBe(true);
269 });
270
271 it('should be true when timer is scheduled', () => {
272 runNgZoneNoLog(() => {
273 setTimeout(() => {}, 0);
274 });
275 expect(_zone.hasPendingMacrotasks).toBe(true);
276 });
277 });
278
279 describe('isInInnerZone', () => {
280 it('should return whether the code executes in the inner zone', () => {
281 expect(NgZone.isInAngularZone()).toEqual(false);
282 runNgZoneNoLog(() => {
283 expect(NgZone.isInAngularZone()).toEqual(true);
284 });
285 });
286 });
287
288 describe('run', () => {
289 it('should return the body return value from run', (done) => {

Callers 1

ng_zone_spec.tsFile · 0.85

Calls 15

injectFunction · 0.90
fakeAsyncFunction · 0.90
flushMicrotasksFunction · 0.90
waitForAsyncFunction · 0.90
flushFunction · 0.90
runNgZoneNoLogFunction · 0.85
setTimeoutFunction · 0.85
macroTaskFunction · 0.85
beforeEachFunction · 0.85
firstValueFromFunction · 0.85
isInAngularZoneMethod · 0.80

Tested by

no test coverage detected