Skip to content

Commit 5fa27f3

Browse files
committed
Accordion: unit test for collapsed height
1 parent fe1aba3 commit 5fa27f3

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

tests/unit/accordion/accordion.html

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,16 @@
77
<script src="../../lib/css.js" data-modules="core accordion"></script>
88
<script src="../../lib/bootstrap.js" data-widget="accordion"></script>
99
<style>
10-
#list, #list1 *, #navigation, #navigation * {
10+
#list, #list1 *, #navigation, #navigation *, #collapsible, #collapsible * {
1111
margin: 0;
1212
padding: 0;
1313
font-size: 12px;
1414
line-height: 15px;
1515
}
16+
#collapsibleWrapper {
17+
width: 300px;
18+
float: left;
19+
}
1620
</style>
1721
</head>
1822
<body>
@@ -108,6 +112,19 @@ <h2><a href="?p=1.1.3">Drums</a></h2>
108112
</dd>
109113
</dl>
110114

115+
<div id="collapsibleWrapper">
116+
<div id="collapsible">
117+
<h3>Header</h3>
118+
<div>
119+
<p>
120+
The calculated height of this accordion should be the same
121+
regardless of whether the accordion was collapsed or not
122+
when the height was calculated.
123+
</p>
124+
</div>
125+
</div>
126+
</div>
127+
111128
</div>
112129
</body>
113130
</html>

tests/unit/accordion/methods.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,18 @@ var equalHeight = testHelper.equalHeight,
1010

1111
module( "accordion: methods", setupTeardown() );
1212

13+
test( "collapsedHeight", function() {
14+
expect( 1 );
15+
var element = $( "#collapsible" ).accordion(),
16+
content = element.find( ".ui-accordion-content" ),
17+
height = content.height();
18+
element.accordion( "destroy" ).accordion({
19+
active: false,
20+
collapsible: true
21+
});
22+
equal( content.height(), height );
23+
});
24+
1325
test( "destroy", function( assert ) {
1426
expect( 1 );
1527
assert.domEqual( "#list1", function() {

0 commit comments

Comments
 (0)