|
| 1 | +import {ApplicationRef, Component} from '@angular/core'; |
1 | 2 | import {TestBed, inject} from '@angular/core/testing';
|
2 |
| -import {ApplicationRef, Component, afterRender} from '@angular/core'; |
| 3 | +import {ComponentPortal} from '../../portal'; |
3 | 4 | import {dispatchFakeEvent, dispatchMouseEvent} from '../../testing/private';
|
4 |
| -import {OverlayModule, Overlay} from '../index'; |
| 5 | +import {Overlay, OverlayModule} from '../index'; |
5 | 6 | import {OverlayOutsideClickDispatcher} from './overlay-outside-click-dispatcher';
|
6 |
| -import {ComponentPortal} from '../../portal'; |
7 |
| -import {filter, take} from 'rxjs/operators'; |
8 | 7 |
|
9 | 8 | describe('OverlayOutsideClickDispatcher', () => {
|
10 | 9 | let appRef: ApplicationRef;
|
@@ -385,44 +384,6 @@ describe('OverlayOutsideClickDispatcher', () => {
|
385 | 384 |
|
386 | 385 | expect(appRef.tick).toHaveBeenCalledTimes(0);
|
387 | 386 | });
|
388 |
| - |
389 |
| - it('should run change detection if the click was made outside the overlay and there are `outsidePointerEvents` observers', async () => { |
390 |
| - let renders = 0; |
391 |
| - TestBed.runInInjectionContext(() => { |
392 |
| - afterRender(() => { |
393 |
| - renders++; |
394 |
| - }); |
395 |
| - }); |
396 |
| - function stablePromise() { |
397 |
| - return TestBed.inject(ApplicationRef) |
398 |
| - .isStable.pipe( |
399 |
| - filter(stable => stable), |
400 |
| - take(1), |
401 |
| - ) |
402 |
| - .toPromise(); |
403 |
| - } |
404 |
| - await stablePromise(); |
405 |
| - expect(renders).toEqual(1); |
406 |
| - const portal = new ComponentPortal(TestComponent); |
407 |
| - const overlayRef = overlay.create(); |
408 |
| - overlayRef.attach(portal); |
409 |
| - outsideClickDispatcher.add(overlayRef); |
410 |
| - |
411 |
| - const context = document.createElement('div'); |
412 |
| - document.body.appendChild(context); |
413 |
| - |
414 |
| - await stablePromise(); |
415 |
| - expect(renders).toEqual(2); |
416 |
| - dispatchMouseEvent(context, 'click'); |
417 |
| - await stablePromise(); |
418 |
| - expect(renders).toEqual(2); |
419 |
| - |
420 |
| - overlayRef.outsidePointerEvents().subscribe(); |
421 |
| - |
422 |
| - dispatchMouseEvent(context, 'click'); |
423 |
| - await stablePromise(); |
424 |
| - expect(renders).toEqual(2); |
425 |
| - }); |
426 | 387 | });
|
427 | 388 | });
|
428 | 389 |
|
|
0 commit comments