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

Commit 752ef73

Browse files
SidhNorpkozlowski-opensource
authored andcommitted
test(accordion): Added test to cover issue 82
1 parent 8975b24 commit 752ef73

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

src/accordion/test/accordionSpec.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,5 +230,32 @@ describe('accordion', function () {
230230
expect(findGroupBody(1).scope().isOpen).toBe(true);
231231
});
232232
});
233+
234+
describe('is-open attribute with dynamic content', function() {
235+
beforeEach(function () {
236+
var tpl =
237+
"<accordion>" +
238+
"<accordion-group heading=\"title 1\" is-open=\"open1\"><div ng-repeat='item in items'>{{item}}</div></accordion-group>" +
239+
"<accordion-group heading=\"title 2\" is-open=\"open2\">Static content</accordion-group>" +
240+
"</accordion>";
241+
element = angular.element(tpl);
242+
scope.items = ['Item 1', 'Item 2', 'Item 3'];
243+
scope.open1 = true;
244+
scope.open2 = false;
245+
angular.element(document.body).append(element);
246+
$compile(element)(scope);
247+
scope.$digest();
248+
groups = element.find('.accordion-group');
249+
});
250+
251+
afterEach(function() {
252+
element.remove();
253+
});
254+
255+
it('should have visible group body when the group with isOpen set to true', function () {
256+
expect(findGroupBody(0)[0].clientHeight).not.toBe(0);
257+
expect(findGroupBody(1)[0].clientHeight).toBe(0);
258+
});
259+
});
233260
});
234261
});

0 commit comments

Comments
 (0)