MCPcopy Create free account
hub / github.com/angular/components / setup

Function setup

src/cdk/overlay/overlay.spec.ts:44–67  ·  view source on GitHub ↗
(providers: Provider[] = [])

Source from the content-addressed store, hash-verified

42 let mockLocation: SpyLocation;
43
44 function setup(providers: Provider[] = []) {
45 dir = signal<Direction>('ltr');
46 TestBed.configureTestingModule({
47 providers: [
48 provideFakeDirectionality(dir),
49 {
50 provide: Location,
51 useClass: SpyLocation,
52 },
53 ...providers,
54 ],
55 });
56
57 injector = TestBed.inject(Injector);
58 overlayContainer = TestBed.inject(OverlayContainer);
59 overlayContainerElement = overlayContainer.getContainerElement();
60
61 const fixture = TestBed.createComponent(TestComponentWithTemplatePortals);
62 fixture.detectChanges();
63 templatePortal = fixture.componentInstance.templatePortal;
64 componentPortal = new ComponentPortal(PizzaMsg, fixture.componentInstance.viewContainerRef);
65 viewContainerFixture = fixture;
66 mockLocation = TestBed.inject(Location) as SpyLocation;
67 }
68
69 function cleanup() {
70 overlayContainer.ngOnDestroy();

Callers 1

overlay.spec.tsFile · 0.70

Calls 3

signalFunction · 0.85
getContainerElementMethod · 0.80

Tested by

no test coverage detected