From 99806649730902fbe180e3e8d0c18a87331b55ad Mon Sep 17 00:00:00 2001 From: Dmitry Nehaychik <4dmitr@gmail.com> Date: Thu, 13 Sep 2018 14:09:52 +0300 Subject: [PATCH] fix(popover): fix popover component example (#711) Closes #618, Closes #619 --- docs/structure.ts | 1 + e2e/popover.e2e-spec.ts | 4 ++-- .../popover/popover-custom-component.component.ts | 5 +++-- src/playground/popover/popover-modes.component.ts | 6 ++++++ src/playground/popover/popover-template-ref.component.ts | 6 ++++++ src/playground/shared/dynamic.component.ts | 2 +- src/playground/shared/shared.module.ts | 3 +++ 7 files changed, 22 insertions(+), 5 deletions(-) diff --git a/docs/structure.ts b/docs/structure.ts index 929b463cab..843f83e7bf 100644 --- a/docs/structure.ts +++ b/docs/structure.ts @@ -311,6 +311,7 @@ export const structure = [ icon: 'popover.svg', source: [ 'NbPopoverDirective', + 'NbPopoverComponent', ], }, { diff --git a/e2e/popover.e2e-spec.ts b/e2e/popover.e2e-spec.ts index 773764c3d8..a0aff6ba57 100644 --- a/e2e/popover.e2e-spec.ts +++ b/e2e/popover.e2e-spec.ts @@ -156,13 +156,13 @@ describe('nb-popover', () => { it('have to render component with context', () => { element(contentComponentWithContext).click(); const text = element(popover).element(by.css('nb-dynamic-to-add > div > strong')).getText(); - expect(text).toEqual('hello from dynamically inserted component: Example context'); + expect(text).toEqual('Hello from custom component: Example context'); }); it('have to render template with context', () => { element(contentTemplateWithContext).click(); const text = element(popover).element(by.css('nb-dynamic-to-add > div > strong')).getText(); - expect(text).toEqual('hello from dynamically inserted component: Example context'); + expect(text).toEqual('Hello from custom component: Example context'); }); it('have to hide popover when host removed', done => { diff --git a/src/playground/popover/popover-custom-component.component.ts b/src/playground/popover/popover-custom-component.component.ts index 2c55f604ac..1348becb8c 100644 --- a/src/playground/popover/popover-custom-component.component.ts +++ b/src/playground/popover/popover-custom-component.component.ts @@ -11,8 +11,9 @@ import { NbDynamicToAddComponent } from '../shared/dynamic.component'; selector: 'nb-popover-custom-component', templateUrl: './popover-custom-component.component.html', styles: [` - nb-layout-column { - height: 50vw; + :host { + display: block; + margin: 5rem; } `], }) diff --git a/src/playground/popover/popover-modes.component.ts b/src/playground/popover/popover-modes.component.ts index 831048076b..69b3ee61a7 100644 --- a/src/playground/popover/popover-modes.component.ts +++ b/src/playground/popover/popover-modes.component.ts @@ -10,6 +10,12 @@ import { Component } from '@angular/core'; @Component({ selector: 'nb-popover-modes', templateUrl: './popover-modes.component.html', + styles: [` + :host { + display: block; + margin: 5rem; + } + `], }) export class NbPopoverModesComponent { } diff --git a/src/playground/popover/popover-template-ref.component.ts b/src/playground/popover/popover-template-ref.component.ts index ad8601a289..ab5e1fe730 100644 --- a/src/playground/popover/popover-template-ref.component.ts +++ b/src/playground/popover/popover-template-ref.component.ts @@ -10,6 +10,12 @@ import { Component } from '@angular/core'; @Component({ selector: 'nb-popover-template-ref', templateUrl: './popover-template-ref.component.html', + styles: [` + :host { + display: block; + margin: 5rem; + } + `], }) export class NbPopoverTemplateRefComponent { } diff --git a/src/playground/shared/dynamic.component.ts b/src/playground/shared/dynamic.component.ts index 4fea61b443..60ac1e0608 100644 --- a/src/playground/shared/dynamic.component.ts +++ b/src/playground/shared/dynamic.component.ts @@ -4,7 +4,7 @@ import { Component, Input } from '@angular/core'; selector: 'nb-dynamic-to-add', template: `
- hello from dynamically inserted component: {{text}} + Hello from custom component: {{ text }}
`, }) diff --git a/src/playground/shared/shared.module.ts b/src/playground/shared/shared.module.ts index 8fae8ff782..8b61066530 100644 --- a/src/playground/shared/shared.module.ts +++ b/src/playground/shared/shared.module.ts @@ -19,6 +19,9 @@ import { NbDynamicToAddComponent } from './dynamic.component'; declarations: [ NbDynamicToAddComponent, ], + entryComponents: [ + NbDynamicToAddComponent, + ], }) export class NbPlaygroundSharedModule { }