Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
contextProperty;
isFirstOnChangesCall = true;
contextPropertyValueOnFirstCdRun;
ngOnInit() {
if (this.isFirstOnChangesCall) {
this.contextPropertyValueOnFirstCdRun = this.contextProperty;
this.isFirstOnChangesCall = false;
}
}
}
// Has to define test module since there is no way to specify entry components
// in 'TestBed.configureTestingModule'.
@NgModule({
imports: [ NbOverlayModule.forRoot() ],
declarations: [ NbOverlayContainerTestComponent, NbOverlayTestComponent ],
entryComponents: [ NbOverlayTestComponent ],
})
export class NbOverlayTestModule {}
describe('NbOverlayContainerComponent', () => {
let fixture: ComponentFixture;
let overlayContainer: NbOverlayContainerComponent;
beforeEach(() => {
TestBed.configureTestingModule({ imports: [ NbOverlayTestModule ] });
fixture = TestBed.createComponent(NbOverlayContainerTestComponent);
fixture.detectChanges();
overlayContainer = fixture.componentInstance.overlayContainer;
});
beforeEach(() => {
TestBed.configureTestingModule({
imports: [
NbThemeModule.forRoot(),
NbOverlayModule.forRoot(),
NbLayoutModule,
PortalModule,
RouterTestingModule.withRoutes([]),
],
});
// Have to create layout component as it's required for scroll service to work properly.
// Also it registers overlay container so we don't have to create it manually.
TestBed.createComponent(NbLayoutComponent);
overlayHostElement = document.createElement('div');
overlayHostElement.style.width = '10px';
overlayHostElement.style.height = '10px';
overlayHostElement.style.backgroundColor = 'red';
document.body.appendChild(overlayHostElement);