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

Commit ffb5529

Browse files
Daniel Blancowesleycho
Daniel Blanco
authored andcommitted
feat(accordion): add bound panel-class support
- Add `@` binding support for `panel-class` Closes #5368 Closes #5596
1 parent d6b9ee1 commit ffb5529

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

src/accordion/accordion.js

+1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ angular.module('ui.bootstrap.accordion', ['ui.bootstrap.collapse'])
6464
},
6565
scope: {
6666
heading: '@', // Interpolate the heading attribute onto this scope
67+
panelClass: '@?', // Ditto with panelClass
6768
isOpen: '=?',
6869
isDisabled: '=?'
6970
},

src/accordion/docs/readme.md

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ The body of each accordion group is transcluded into the body of the collapsible
3333
Whether accordion group is open or closed.
3434

3535
* `panel-class`
36+
<i class="glyphicon glyphicon-eye-open"></i>
3637
_(Default: `panel-default`)_ -
3738
Add ability to use Bootstrap's contextual panel classes (panel-primary, panel-success, panel-info, etc...) or your own. This must be a string.
3839

src/accordion/test/accordion.spec.js

+16-3
Original file line numberDiff line numberDiff line change
@@ -610,8 +610,8 @@ describe('uib-accordion', function() {
610610
});
611611
});
612612

613-
describe('uib-accordion group panel class - #3968', function() {
614-
it('should use the default value when panel class is falsy', function() {
613+
describe('uib-accordion group panel class', function() {
614+
it('should use the default value when panel class is falsy - #3968', function() {
615615
element = $compile('<uib-accordion><uib-accordion-group heading="Heading">Content</uib-accordion-group></uib-accordion>')(scope);
616616
scope.$digest();
617617
groups = element.find('.panel');
@@ -623,13 +623,26 @@ describe('uib-accordion', function() {
623623
expect(groups.eq(0)).toHaveClass('panel-default');
624624
});
625625

626-
it('should use the specified value when not falsy', function() {
626+
it('should use the specified value when not falsy - #3968', function() {
627627
element = $compile('<uib-accordion><uib-accordion-group heading="Heading" panel-class="custom-class">Content</uib-accordion-group></uib-accordion>')(scope);
628628
scope.$digest();
629629
groups = element.find('.panel');
630630
expect(groups.eq(0)).toHaveClass('custom-class');
631631
expect(groups.eq(0)).not.toHaveClass('panel-default');
632632
});
633+
634+
it('should change class if panel-class is changed', function() {
635+
element = $compile('<uib-accordion><uib-accordion-group heading="Heading" panel-class="{{panelClass}}">Content</uib-accordion-group></uib-accordion>')(scope);
636+
scope.panelClass = 'custom-class';
637+
scope.$digest();
638+
groups = element.find('.panel');
639+
expect(groups.eq(0)).toHaveClass('custom-class');
640+
641+
scope.panelClass = 'different-class';
642+
scope.$digest();
643+
expect(groups.eq(0)).toHaveClass('different-class');
644+
expect(groups.eq(0)).not.toHaveClass('custom-class');
645+
});
633646
});
634647
});
635648
});

0 commit comments

Comments
 (0)