Skip to content

Commit

Permalink
fix(angular): inline modals now add .ion-page class correctly (#24751)
Browse files Browse the repository at this point in the history
resolves #24750
  • Loading branch information
liamdebeasi committed Feb 9, 2022
1 parent 0580d65 commit ef46eaf
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion angular/src/directives/overlays/modal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export declare interface IonModal extends Components.IonModal {
@Component({
selector: 'ion-modal',
changeDetection: ChangeDetectionStrategy.OnPush,
template: `<ng-container [ngTemplateOutlet]="template" *ngIf="isCmpOpen"></ng-container>`,
template: `<div class="ion-page"><ng-container [ngTemplateOutlet]="template" *ngIf="isCmpOpen"></ng-container></div>`,
inputs: [
'animated',
'backdropBreakpoint',
Expand Down
4 changes: 4 additions & 0 deletions angular/test/test-app/e2e/src/modal.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,8 @@ describe('Modals: Inline', () => {
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');
});

it('should have a div with .ion-page', () => {
cy.get('ion-modal').children('.ion-page').should('exist');
});
});
2 changes: 1 addition & 1 deletion core/src/utils/framework-delegate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export const CoreDelegate = () => {
BaseComponent.appendChild(el);

await new Promise(resolve => componentOnReady(el, resolve));
} else {
} else if (BaseComponent.children.length > 0) {
// If there is no component, then we need to create a new parent
// element to apply the css classes to.
const el = BaseComponent.ownerDocument && BaseComponent.ownerDocument.createElement('div');
Expand Down

0 comments on commit ef46eaf

Please sign in to comment.