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

Commit 359d0ea

Browse files
committed
Accordion tests: equalHeights() -> equalHeight(); Validate against a specific height instead of a range.
1 parent a738d73 commit 359d0ea

File tree

4 files changed

+17
-22
lines changed

4 files changed

+17
-22
lines changed

tests/unit/accordion/accordion_deprecated.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
(function( $ ) {
22

3-
var equalHeights = TestHelpers.accordion.equalHeights,
3+
var equalHeight = TestHelpers.accordion.equalHeight,
44
setupTeardown = TestHelpers.accordion.setupTeardown,
55
state = TestHelpers.accordion.state;
66

@@ -109,7 +109,7 @@ module( "accordion (deprecated) - height options", setupTeardown() );
109109

110110
test( "{ autoHeight: true }, default", function() {
111111
expect( 3 );
112-
equalHeights( $( "#navigation" ).accordion({ autoHeight: true }), 95, 130 );
112+
equalHeight( $( "#navigation" ).accordion({ autoHeight: true }), 105 );
113113
});
114114

115115
test( "{ autoHeight: false }", function() {
@@ -128,7 +128,7 @@ test( "{ fillSpace: true }", function() {
128128
expect( 3 );
129129
$( "#navigationWrapper" ).height( 500 );
130130
var element = $( "#navigation" ).accordion({ fillSpace: true });
131-
equalHeights( element, 446, 458 );
131+
equalHeight( element, 455 );
132132
});
133133

134134
test( "{ fillSapce: true } with sibling", function() {
@@ -142,7 +142,7 @@ test( "{ fillSapce: true } with sibling", function() {
142142
})
143143
.prependTo( "#navigationWrapper" );
144144
var element = $( "#navigation" ).accordion({ fillSpace: true });
145-
equalHeights( element , 346, 358);
145+
equalHeight( element , 355 );
146146
});
147147

148148
test( "{ fillSpace: true } with multiple siblings", function() {
@@ -171,7 +171,7 @@ test( "{ fillSpace: true } with multiple siblings", function() {
171171
})
172172
.prependTo( "#navigationWrapper" );
173173
var element = $( "#navigation" ).accordion({ fillSpace: true });
174-
equalHeights( element, 296, 308 );
174+
equalHeight( element, 305 );
175175
});
176176

177177

@@ -206,11 +206,11 @@ test( "resize", function() {
206206
.accordion({
207207
heightStyle: "fill"
208208
});
209-
equalHeights( element, 246, 258 );
209+
equalHeight( element, 255 );
210210

211211
element.parent().height( 500 );
212212
element.accordion( "resize" );
213-
equalHeights( element, 446, 458 );
213+
equalHeight( element, 455 );
214214
});
215215

216216

tests/unit/accordion/accordion_methods.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
(function( $ ) {
22

3-
var equalHeights = TestHelpers.accordion.equalHeights,
3+
var equalHeight = TestHelpers.accordion.equalHeight,
44
setupTeardown = TestHelpers.accordion.setupTeardown,
55
state = TestHelpers.accordion.state;
66

@@ -38,11 +38,11 @@ test( "refresh", function() {
3838
.accordion({
3939
heightStyle: "fill"
4040
});
41-
equalHeights( element, 246, 258 );
41+
equalHeight( element, 255 );
4242

4343
element.parent().height( 500 );
4444
element.accordion( "refresh" );
45-
equalHeights( element, 446, 458 );
45+
equalHeight( element, 455 );
4646
});
4747

4848
}( jQuery ) );

tests/unit/accordion/accordion_options.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
(function( $ ) {
22

3-
var equalHeights = TestHelpers.accordion.equalHeights,
3+
var equalHeight = TestHelpers.accordion.equalHeight,
44
setupTeardown = TestHelpers.accordion.setupTeardown,
55
state = TestHelpers.accordion.state;
66

@@ -359,7 +359,7 @@ test( "{ header: custom }", function() {
359359
test( "{ heightStyle: 'auto' }", function() {
360360
expect( 3 );
361361
var element = $( "#navigation" ).accordion({ heightStyle: "auto" });
362-
equalHeights( element, 95, 130 );
362+
equalHeight( element, 105 );
363363
});
364364

365365
test( "{ heightStyle: 'content' }", function() {
@@ -377,7 +377,7 @@ test( "{ heightStyle: 'fill' }", function() {
377377
expect( 3 );
378378
$( "#navigationWrapper" ).height( 500 );
379379
var element = $( "#navigation" ).accordion({ heightStyle: "fill" });
380-
equalHeights( element, 446, 458 );
380+
equalHeight( element, 455 );
381381
});
382382

383383
test( "{ heightStyle: 'fill' } with sibling", function() {
@@ -391,7 +391,7 @@ test( "{ heightStyle: 'fill' } with sibling", function() {
391391
})
392392
.prependTo( "#navigationWrapper" );
393393
var element = $( "#navigation" ).accordion({ heightStyle: "fill" });
394-
equalHeights( element , 346, 358);
394+
equalHeight( element , 355 );
395395
});
396396

397397
test( "{ heightStyle: 'fill' } with multiple siblings", function() {
@@ -420,7 +420,7 @@ test( "{ heightStyle: 'fill' } with multiple siblings", function() {
420420
})
421421
.prependTo( "#navigationWrapper" );
422422
var element = $( "#navigation" ).accordion({ heightStyle: "fill" });
423-
equalHeights( element, 296, 308 );
423+
equalHeight( element, 305 );
424424
});
425425

426426
test( "{ icons: false }", function() {

tests/unit/accordion/accordion_test_helpers.js

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
TestHelpers.accordion = {
2-
equalHeights: function( accordion, min, max ) {
3-
var sizes = [];
2+
equalHeight: function( accordion, height ) {
43
accordion.find( ".ui-accordion-content" ).each(function() {
5-
sizes.push( $( this ).outerHeight() );
4+
equal( $( this ).outerHeight(), height );
65
});
7-
ok( sizes[ 0 ] >= min && sizes[ 0 ] <= max,
8-
"must be within " + min + " and " + max + ", was " + sizes[ 0 ] );
9-
deepEqual( sizes[ 0 ], sizes[ 1 ] );
10-
deepEqual( sizes[ 0 ], sizes[ 2 ] );
116
},
127

138
setupTeardown: function() {

0 commit comments

Comments
 (0)