Skip to content

Commit

Permalink
fix(module: accordion): fix accordion expand and collapse error when …
Browse files Browse the repository at this point in the history
…quick click (#614)

* fix(module: accordion): fix accordion expand and collapse error when quick click
  • Loading branch information
nuonuoge authored and Guoyuanqiang committed Nov 21, 2019
1 parent 756f5be commit 567ff59
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
Expand Up @@ -91,7 +91,9 @@ export class AccordionGroupComponent {

slideAnimationDoen(event) {
if (event.fromState === 'down' && event.toState === 'up') {
this.isShowChild = false;
setTimeout(() => {
this.isShowChild = false;
}, 0);
}
}
}
17 changes: 6 additions & 11 deletions components/accordion/accordion.component.spec.ts
Expand Up @@ -35,24 +35,19 @@ describe('AccordionComponent', () => {
expect(component).toBeTruthy();
});

it('should expandall, accordion work', () => {
it('should accordionpanel open close work', () => {
fixture.detectChanges();
component.accordions = [{ title: 'Title 1', child: ['content 1', 'content 1'] }];
component.activeKey = undefined;
component.expandAll = false;
component.expandAll = true;
component.accordion = false;
fixture.detectChanges();
let accordionPanelEle = accordionEle.nativeElement.querySelector('accordionpanel');
});

it('should expandall, accordion work', () => {
accordionEle.nativeElement.querySelector('.am-accordion-header').click();
fixture.detectChanges();
component.accordions = [{ title: 'Title 1', child: ['content 1', 'content 1'] }];
component.activeKey = undefined;
component.expandAll = false;
component.accordion = false;
expect(accordionEle.nativeElement.querySelector('.am-accordion-content').classList).toContain('am-accordion-content-active');
accordionEle.nativeElement.querySelector('.am-accordion-header').click();
fixture.detectChanges();
let accordionPanelEle = accordionEle.nativeElement.querySelector('accordionpanel');
expect(accordionEle.nativeElement.querySelector('.am-accordion-content-active')).toBeNull();
});

it('should expandall, accordion work', () => {
Expand Down

0 comments on commit 567ff59

Please sign in to comment.