Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(accordion): accordions expand when using binding (#25322)
resolves #25307
- Loading branch information
1 parent
6005431
commit 61e571e
Showing
9 changed files
with
98 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
describe('Accordion', () => { | ||
beforeEach(() => { | ||
cy.visit('/accordions'); | ||
}); | ||
|
||
it('should correctly expand on multiple modal opens', () => { | ||
cy.get('#open-modal').click(); | ||
|
||
cy.get('ion-accordion:first-of-type').should('have.class', 'accordion-expanded'); | ||
cy.get('ion-accordion:last-of-type').should('not.have.class', 'accordion-expanded'); | ||
|
||
cy.get('#dismiss').click(); | ||
|
||
cy.get('#open-modal').click(); | ||
|
||
cy.get('ion-accordion:first-of-type').should('have.class', 'accordion-expanded'); | ||
cy.get('ion-accordion:last-of-type').should('not.have.class', 'accordion-expanded'); | ||
}); | ||
}); |
17 changes: 17 additions & 0 deletions
17
angular/test/test-app/src/app/accordion/accordion-modal/accordion-modal.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<ion-content> | ||
<ion-button id="dismiss" (click)="modal.dismiss()">Dismiss Modal</ion-button> | ||
<ion-accordion-group [value]="'a'"> | ||
<ion-accordion value="a"> | ||
<ion-item slot="header"> | ||
<ion-label>A</ion-label> | ||
</ion-item> | ||
<div slot="content">A content</div> | ||
</ion-accordion> | ||
<ion-accordion value="b"> | ||
<ion-item slot="header"> | ||
<ion-label>B</ion-label> | ||
</ion-item> | ||
<div slot="content">B content</div> | ||
</ion-accordion> | ||
</ion-accordion-group> | ||
</ion-content> |
11 changes: 11 additions & 0 deletions
11
angular/test/test-app/src/app/accordion/accordion-modal/accordion-modal.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'app-accordion-modal', | ||
templateUrl: './accordion-modal.component.html', | ||
}) | ||
export class AccordionModalComponent { | ||
modal: HTMLIonModalElement; | ||
|
||
constructor() {} | ||
} |
13 changes: 13 additions & 0 deletions
13
angular/test/test-app/src/app/accordion/accordion.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<ion-header> | ||
<ion-toolbar> | ||
<ion-buttons> | ||
<ion-back-button></ion-back-button> | ||
</ion-buttons> | ||
<ion-title> | ||
Accordion test | ||
</ion-title> | ||
</ion-toolbar> | ||
</ion-header> | ||
<ion-content> | ||
<ion-button id="open-modal" (click)="open()">Open Modal</ion-button> | ||
</ion-content> |
22 changes: 22 additions & 0 deletions
22
angular/test/test-app/src/app/accordion/accordion.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { Component } from '@angular/core'; | ||
import { ModalController } from '@ionic/angular'; | ||
import { AccordionModalComponent } from './accordion-modal/accordion-modal.component'; | ||
|
||
@Component({ | ||
selector: 'app-accordion', | ||
templateUrl: './accordion.component.html', | ||
}) | ||
export class AccordionComponent { | ||
|
||
constructor( | ||
private modalCtrl: ModalController | ||
) { } | ||
|
||
async open() { | ||
const modal = await this.modalCtrl.create({ | ||
component: AccordionModalComponent, | ||
animated: false, | ||
}); | ||
await modal.present(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters