Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

fix(accordion): add open class when expanded #4152

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/accordion/test/accordion.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ describe('accordion', function () {
it('should expose the controller on the view', function () {
$templateCache.put('template/accordion/accordion.html', '<div>{{accordion.text}}</div>');

element = $compile('<accordion></accordion')(scope);
element = $compile('<accordion></accordion>')(scope);
scope.$digest();

var ctrl = element.controller('accordion');
Expand Down Expand Up @@ -211,6 +211,16 @@ describe('accordion', function () {
scope.$digest();
expect(findGroupBody(0).scope().isOpen).toBe(false);
});

it('should add "open" when opened', function() {
findGroupLink(0).click();
scope.$digest();
expect(findGroupBody(0)).toHaveClass('open');

findGroupLink(0).click();
scope.$digest();
expect(findGroupBody(0)).not.toHaveClass('open');
});
});

describe('with dynamic panels', function () {
Expand Down
2 changes: 1 addition & 1 deletion template/accordion/accordion-group.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ <h4 class="panel-title">
<a href tabindex="0" class="accordion-toggle" ng-click="toggleOpen()" accordion-transclude="heading"><span ng-class="{'text-muted': isDisabled}">{{heading}}</span></a>
</h4>
</div>
<div class="panel-collapse collapse" collapse="!isOpen">
<div class="panel-collapse collapse" collapse="!isOpen" ng-class="{'open': isOpen}">
<div class="panel-body" ng-transclude></div>
</div>
</div>