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

Commit

Permalink
fix(accordion): add open class when expanded
Browse files Browse the repository at this point in the history
- add `open` class to `.panel-collapse` when open.
- fix missing closing `<` on test.

Closes #4152
Fixes #3419
  • Loading branch information
icfantv authored and wesleycho committed Aug 8, 2015
1 parent 22b16f0 commit ead15e3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 12 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,17 @@ describe('accordion', function () {
scope.$digest();
expect(findGroupBody(0).scope().isOpen).toBe(false);
});

it('should add "open" when opened', function() {
var group = groups.eq(0);
findGroupLink(0).click();
scope.$digest();
expect(group).toHaveClass('panel-open');

findGroupLink(0).click();
scope.$digest();
expect(group).not.toHaveClass('panel-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
@@ -1,4 +1,4 @@
<div class="panel panel-default">
<div class="panel panel-default" ng-class="{'panel-open': isOpen}">
<div class="panel-heading">
<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>
Expand Down

2 comments on commit ead15e3

@blowsie
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit broke my page, I can no longer use ng-class on an accordion group

@bcruddy
Copy link

@bcruddy bcruddy commented on ead15e3 Jun 27, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@blowsie did you ever find a work around?

edit: apparently this is fixed in 0.14.1

Please sign in to comment.