How to use the @nebular/theme.NbComponentPortal function in @nebular/theme

To help you get started, we’ve selected a few @nebular/theme examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github akveo / nebular / src / framework / theme / components / cdk / overlay / overlay-position.spec.ts View on Github external
it('should map right position to end', () => {
    const withPositionsSpy = spyOn(strategy, 'withPositions').and.callThrough();

    strategy.position(NbPosition.RIGHT).adjustment(NbAdjustment.HORIZONTAL);

    const overlayService: NbOverlayService = TestBed.get(NbOverlayService);
    const overlayRef = overlayService.create({ positionStrategy: strategy });
    overlayRef.attach(new NbComponentPortal(PortalComponent));

    expect(withPositionsSpy).toHaveBeenCalledWith(jasmine.objectContaining([
      { originX: 'end', originY: 'center', overlayX: 'start', overlayY: 'center', offsetX: 15 },
      { originX: 'start', originY: 'center', overlayX: 'end', overlayY: 'center', offsetX: -15 },
    ]));
  });
});
github akveo / nebular / src / framework / theme / components / cdk / overlay / overlay-container.spec.ts View on Github external
it('should set context before change detection run', () => {
    const context = { contextProperty: 'contextProperty' };
    const portal: NbComponentPortal = new NbComponentPortal(NbOverlayTestComponent);
    const portalRef = overlayContainer.attachComponentPortal(portal, context);

    expect(portalRef.instance.contextPropertyValueOnFirstCdRun).toEqual(context.contextProperty);
  });
});