Skip to content

Commit

Permalink
feat(accordion): add disabled attribute on card level
Browse files Browse the repository at this point in the history
  • Loading branch information
gpolychronis-amadeus committed Jan 29, 2020
1 parent 035d399 commit ff05200
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/accordion/accordion.spec.ts
Expand Up @@ -491,6 +491,12 @@ describe('ngb-accordion', () => {
fixture.detectChanges();
expectOpenPanels(fixture.nativeElement, [false, false, false]);
expect(headingLinks[0].disabled).toBeTruthy();
expect((<HTMLDivElement[]>Array.from(fixture.nativeElement.querySelectorAll('.card')))[0])
.toHaveCssClass('disabled');
expect((<HTMLDivElement[]>Array.from(fixture.nativeElement.querySelectorAll('.card')))[1])
.not.toHaveCssClass('disabled');
expect((<HTMLDivElement[]>Array.from(fixture.nativeElement.querySelectorAll('.card')))[2])
.not.toHaveCssClass('disabled');
});

it('should remove collapsed panels content from DOM', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/accordion/accordion.ts
Expand Up @@ -156,7 +156,7 @@ export interface NgbPanelChangeEvent {
</button>
</ng-template>
<ng-template ngFor let-panel [ngForOf]="panels">
<div class="card">
<div class="card" [class.disabled]="panel.disabled">
<div role="tab" id="{{panel.id}}-header" [class]="'card-header ' + (panel.type ? 'bg-'+panel.type: type ? 'bg-'+type : '')">
<ng-template [ngTemplateOutlet]="panel.headerTpl?.templateRef || t"
[ngTemplateOutletContext]="{$implicit: panel, opened: panel.isOpen}"></ng-template>
Expand Down

0 comments on commit ff05200

Please sign in to comment.