Skip to content

Commit 1f2b02d

Browse files
authored
Merge pull request #10653 from IgniteUI/mkirkova/fix-10520-13.0.x
Emit panelCollapsing event once when a panel starts collapsing
2 parents 13ebccf + ecac53a commit 1f2b02d

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

projects/igniteui-angular/src/lib/expansion-panel/expansion-panel.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,8 @@ export class IgxExpansionPanelComponent extends ToggleAnimationPlayer implements
225225
* ```
226226
*/
227227
public collapse(evt?: Event) {
228-
if (this.collapsed) { // If expansion panel is already collapsed, do nothing
228+
// If expansion panel is already collapsed or is collapsing, do nothing
229+
if (this.collapsed || this.closeAnimationPlayer) {
229230
return;
230231
}
231232
const args = { event: evt, panel: this, owner: this, cancel: false };

projects/igniteui-angular/src/lib/expansion-panel/expansion-panel.spec.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,16 @@ describe('igxExpansionPanel', () => {
196196
expect(panel.collapsed).toBeFalsy();
197197
expect(header.interaction.emit).toHaveBeenCalledTimes(4);
198198
expect(panel.contentCollapsed.emit).toHaveBeenCalledTimes(1);
199+
200+
// collapse when the panel has already started collapsing
201+
header.onAction(mockEvent);
202+
header.onAction(mockEvent);
203+
tick();
204+
fixture.detectChanges();
205+
206+
expect(panel.collapsed).toBeTruthy();
207+
expect(header.interaction.emit).toHaveBeenCalledTimes(6);
208+
expect(panel.contentCollapsing.emit).toHaveBeenCalledTimes(2);
199209
}));
200210

201211
it('Should expand/collapse without animation when animationSettings === null', fakeAsync(() => {

0 commit comments

Comments
 (0)