diff --git a/e2e/popover.e2e-spec.ts b/e2e/popover.e2e-spec.ts index 12c0a5aa35..93f985c707 100644 --- a/e2e/popover.e2e-spec.ts +++ b/e2e/popover.e2e-spec.ts @@ -164,4 +164,13 @@ describe('nb-popover', () => { const text = element(popover).element(by.css('nb-dynamic-to-add > div > strong')).getText(); expect(text).toEqual('hello from dynamically inserted component: Example context'); }); + + it('have to hide popover when host removed', done => { + element(contentTemplate).click(); + expect(element(popover).isPresent()).toBeTruthy(); + browser.get('#/').then(() => { + expect(element(popover).isPresent()).toBeFalsy(); + done(); + }) + }); }); diff --git a/src/framework/theme/components/popover/popover.directive.ts b/src/framework/theme/components/popover/popover.directive.ts index 7391ac5a25..5ab030698f 100644 --- a/src/framework/theme/components/popover/popover.directive.ts +++ b/src/framework/theme/components/popover/popover.directive.ts @@ -167,6 +167,7 @@ export class NbPopoverDirective implements OnInit, OnDestroy { ngOnDestroy() { this.alive = false; + this.hide(); } /**