MCPcopy
hub / github.com/angular/angular / commonTests

Function commonTests

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

Source from the content-addressed store, hash-verified

239});
240
241function commonTests() {
242 describe('hasPendingMicrotasks', () => {
243 it('should be false', () => {
244 expect(_zone.hasPendingMicrotasks).toBe(false);
245 });
246
247 it('should be true', () => {
248 runNgZoneNoLog(() => {
249 queueMicrotask(() => {});
250 });
251 expect(_zone.hasPendingMicrotasks).toBe(true);
252 });
253 });
254
255 describe('hasPendingTimers', () => {
256 it('should be false', () => {
257 expect(_zone.hasPendingMacrotasks).toBe(false);
258 });
259
260 it('should be true', () => {
261 runNgZoneNoLog(() => {
262 setTimeout(() => {}, 0);
263 });
264 expect(_zone.hasPendingMacrotasks).toBe(true);
265 });
266 });
267
268 describe('hasPendingAsyncTasks', () => {
269 it('should be false', () => {
270 expect(_zone.hasPendingMicrotasks).toBe(false);
271 });
272
273 it('should be true when microtask is scheduled', () => {
274 runNgZoneNoLog(() => {
275 queueMicrotask(() => {});
276 });
277 expect(_zone.hasPendingMicrotasks).toBe(true);
278 });
279
280 it('should be true when timer is scheduled', () => {
281 runNgZoneNoLog(() => {
282 setTimeout(() => {}, 0);
283 });
284 expect(_zone.hasPendingMacrotasks).toBe(true);
285 });
286 });
287
288 describe('isInInnerZone', () => {
289 it('should return whether the code executes in the inner zone', () => {
290 expect(NgZone.isInAngularZone()).toEqual(false);
291 runNgZoneNoLog(() => {
292 expect(NgZone.isInAngularZone()).toEqual(true);
293 });
294 });
295 });
296
297 describe('run', () => {
298 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

Used in the wild real call sites across dependent graphs

searching dependent graphs…