diff --git a/angular/src/directives/overlays/modal.ts b/angular/src/directives/overlays/modal.ts index a454b2efc0..d0378b4eac 100644 --- a/angular/src/directives/overlays/modal.ts +++ b/angular/src/directives/overlays/modal.ts @@ -103,7 +103,6 @@ export class IonModal { protected el: HTMLElement; constructor(c: ChangeDetectorRef, r: ElementRef, protected z: NgZone) { - c.detach(); this.el = r.nativeElement; this.el.addEventListener('willPresent', () => { diff --git a/angular/src/directives/overlays/popover.ts b/angular/src/directives/overlays/popover.ts index dbd9e56a3c..0bcf5f7e26 100644 --- a/angular/src/directives/overlays/popover.ts +++ b/angular/src/directives/overlays/popover.ts @@ -104,7 +104,6 @@ export class IonPopover { protected el: HTMLElement; constructor(c: ChangeDetectorRef, r: ElementRef, protected z: NgZone) { - c.detach(); this.el = r.nativeElement; this.el.addEventListener('willPresent', () => { diff --git a/angular/test/test-app/e2e/src/modal.spec.ts b/angular/test/test-app/e2e/src/modal.spec.ts index 8b96b9bb22..67b65576a2 100644 --- a/angular/test/test-app/e2e/src/modal.spec.ts +++ b/angular/test/test-app/e2e/src/modal.spec.ts @@ -41,3 +41,23 @@ describe('Modals', () => { }); }); + + +describe('Modals: Inline', () => { + beforeEach(() => { + cy.visit('/modal-inline'); + }); + + it('should initially have no items', () => { + cy.get('ion-list ion-item').should('not.exist'); + }); + + it('should have items after 1500ms', () => { + cy.wait(1500); + + cy.get('ion-list ion-item:nth-child(1)').should('have.text', 'A'); + cy.get('ion-list ion-item:nth-child(2)').should('have.text', 'B'); + cy.get('ion-list ion-item:nth-child(3)').should('have.text', 'C'); + cy.get('ion-list ion-item:nth-child(4)').should('have.text', 'D'); + }); +}); diff --git a/angular/test/test-app/e2e/src/popover.spec.ts b/angular/test/test-app/e2e/src/popover.spec.ts new file mode 100644 index 0000000000..abf1c06fa1 --- /dev/null +++ b/angular/test/test-app/e2e/src/popover.spec.ts @@ -0,0 +1,18 @@ +describe('Popovers: Inline', () => { + beforeEach(() => { + cy.visit('/popover-inline'); + }); + + it('should initially have no items', () => { + cy.get('ion-list ion-item').should('not.exist'); + }); + + it('should have items after 1500ms', () => { + cy.wait(1500); + + cy.get('ion-list ion-item:nth-child(1)').should('have.text', 'A'); + cy.get('ion-list ion-item:nth-child(2)').should('have.text', 'B'); + cy.get('ion-list ion-item:nth-child(3)').should('have.text', 'C'); + cy.get('ion-list ion-item:nth-child(4)').should('have.text', 'D'); + }); +}); diff --git a/angular/test/test-app/src/app/app-routing.module.ts b/angular/test/test-app/src/app/app-routing.module.ts index 6d99c69fc0..2517081171 100644 --- a/angular/test/test-app/src/app/app-routing.module.ts +++ b/angular/test/test-app/src/app/app-routing.module.ts @@ -27,7 +27,9 @@ const routes: Routes = [ { path: 'inputs', component: InputsComponent }, { path: 'form', component: FormComponent }, { path: 'modals', component: ModalComponent }, + { path: 'modal-inline', loadChildren: () => import('./modal-inline').then(m => m.ModalInlineModule) }, { path: 'view-child', component: ViewChildComponent }, + { path: 'popover-inline', loadChildren: () => import('./popover-inline').then(m => m.PopoverInlineModule) }, { path: 'providers', component: ProvidersComponent }, { path: 'router-link', component: RouterLinkComponent }, { path: 'router-link-page', component: RouterLinkPageComponent }, diff --git a/angular/test/test-app/src/app/modal-inline/index.ts b/angular/test/test-app/src/app/modal-inline/index.ts new file mode 100644 index 0000000000..234b925feb --- /dev/null +++ b/angular/test/test-app/src/app/modal-inline/index.ts @@ -0,0 +1,2 @@ +export * from './modal-inline.component'; +export * from './modal-inline.module'; diff --git a/angular/test/test-app/src/app/modal-inline/modal-inline-routing.module.ts b/angular/test/test-app/src/app/modal-inline/modal-inline-routing.module.ts new file mode 100644 index 0000000000..581b366a1d --- /dev/null +++ b/angular/test/test-app/src/app/modal-inline/modal-inline-routing.module.ts @@ -0,0 +1,16 @@ +import { NgModule } from "@angular/core"; +import { RouterModule } from "@angular/router"; +import { ModalInlineComponent } from "."; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { + path: '', + component: ModalInlineComponent + } + ]) + ], + exports: [RouterModule] +}) +export class ModalInlineRoutingModule { } diff --git a/angular/test/test-app/src/app/modal-inline/modal-inline.component.html b/angular/test/test-app/src/app/modal-inline/modal-inline.component.html new file mode 100644 index 0000000000..111b6893fa --- /dev/null +++ b/angular/test/test-app/src/app/modal-inline/modal-inline.component.html @@ -0,0 +1,11 @@ + + + + + + {{ item }} + + + + + diff --git a/angular/test/test-app/src/app/modal-inline/modal-inline.component.ts b/angular/test/test-app/src/app/modal-inline/modal-inline.component.ts new file mode 100644 index 0000000000..1167505685 --- /dev/null +++ b/angular/test/test-app/src/app/modal-inline/modal-inline.component.ts @@ -0,0 +1,21 @@ +import { AfterViewInit, Component } from "@angular/core"; + +/** + * Validates that inline modals will correctly display + * dynamic contents that are updated after the modal is + * display. + */ +@Component({ + selector: 'app-modal-inline', + templateUrl: 'modal-inline.component.html' +}) +export class ModalInlineComponent implements AfterViewInit { + + items: string[] = []; + + ngAfterViewInit(): void { + setTimeout(() => { + this.items = ['A', 'B', 'C', 'D']; + }, 1000); + } +} diff --git a/angular/test/test-app/src/app/modal-inline/modal-inline.module.ts b/angular/test/test-app/src/app/modal-inline/modal-inline.module.ts new file mode 100644 index 0000000000..2d75ec3ca4 --- /dev/null +++ b/angular/test/test-app/src/app/modal-inline/modal-inline.module.ts @@ -0,0 +1,12 @@ +import { CommonModule } from "@angular/common"; +import { NgModule } from "@angular/core"; +import { IonicModule } from "@ionic/angular"; +import { ModalInlineRoutingModule } from "./modal-inline-routing.module"; +import { ModalInlineComponent } from "./modal-inline.component"; + +@NgModule({ + imports: [CommonModule, IonicModule, ModalInlineRoutingModule], + declarations: [ModalInlineComponent], + exports: [ModalInlineComponent] +}) +export class ModalInlineModule { } diff --git a/angular/test/test-app/src/app/popover-inline/index.ts b/angular/test/test-app/src/app/popover-inline/index.ts new file mode 100644 index 0000000000..19e9887c9c --- /dev/null +++ b/angular/test/test-app/src/app/popover-inline/index.ts @@ -0,0 +1 @@ +export * from './popover-inline.module'; diff --git a/angular/test/test-app/src/app/popover-inline/popover-inline-routing.module.ts b/angular/test/test-app/src/app/popover-inline/popover-inline-routing.module.ts new file mode 100644 index 0000000000..4a30122a38 --- /dev/null +++ b/angular/test/test-app/src/app/popover-inline/popover-inline-routing.module.ts @@ -0,0 +1,14 @@ +import { NgModule } from "@angular/core"; +import { RouterModule } from "@angular/router"; +import { PopoverInlineComponent } from "./popover-inline.component"; + +@NgModule({ + imports: [RouterModule.forChild([ + { + path: '', + component: PopoverInlineComponent + } + ])], + exports: [RouterModule] +}) +export class PopoverInlineRoutingModule { } diff --git a/angular/test/test-app/src/app/popover-inline/popover-inline.component.html b/angular/test/test-app/src/app/popover-inline/popover-inline.component.html new file mode 100644 index 0000000000..1de4bc20af --- /dev/null +++ b/angular/test/test-app/src/app/popover-inline/popover-inline.component.html @@ -0,0 +1,11 @@ + + + + + + {{ item }} + + + + + diff --git a/angular/test/test-app/src/app/popover-inline/popover-inline.component.ts b/angular/test/test-app/src/app/popover-inline/popover-inline.component.ts new file mode 100644 index 0000000000..d162795795 --- /dev/null +++ b/angular/test/test-app/src/app/popover-inline/popover-inline.component.ts @@ -0,0 +1,22 @@ +import { AfterViewInit, Component } from "@angular/core"; + +/** + * Validates that inline popovers will correctly display + * dynamic contents that are updated after the modal is + * display. + */ +@Component({ + selector: 'app-popover-inline', + templateUrl: 'popover-inline.component.html' +}) +export class PopoverInlineComponent implements AfterViewInit { + + items: string[] = []; + + ngAfterViewInit(): void { + setTimeout(() => { + this.items = ['A', 'B', 'C', 'D']; + }, 1000); + } + +} diff --git a/angular/test/test-app/src/app/popover-inline/popover-inline.module.ts b/angular/test/test-app/src/app/popover-inline/popover-inline.module.ts new file mode 100644 index 0000000000..8a84d9f4d4 --- /dev/null +++ b/angular/test/test-app/src/app/popover-inline/popover-inline.module.ts @@ -0,0 +1,11 @@ +import { CommonModule } from "@angular/common"; +import { NgModule } from "@angular/core"; +import { IonicModule } from "@ionic/angular"; +import { PopoverInlineRoutingModule } from "./popover-inline-routing.module"; +import { PopoverInlineComponent } from "./popover-inline.component"; + +@NgModule({ + imports: [CommonModule, IonicModule, PopoverInlineRoutingModule], + declarations: [PopoverInlineComponent], +}) +export class PopoverInlineModule { }