()
| 239 | }); |
| 240 | |
| 241 | function 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) => { |
no test coverage detected
searching dependent graphs…