mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Accordion tests: equalHeights() -> equalHeight(); Validate against a specific height instead of a range.
This commit is contained in:
parent
a738d7372e
commit
359d0eadd0
@ -1,6 +1,6 @@
|
||||
(function( $ ) {
|
||||
|
||||
var equalHeights = TestHelpers.accordion.equalHeights,
|
||||
var equalHeight = TestHelpers.accordion.equalHeight,
|
||||
setupTeardown = TestHelpers.accordion.setupTeardown,
|
||||
state = TestHelpers.accordion.state;
|
||||
|
||||
@ -109,7 +109,7 @@ module( "accordion (deprecated) - height options", setupTeardown() );
|
||||
|
||||
test( "{ autoHeight: true }, default", function() {
|
||||
expect( 3 );
|
||||
equalHeights( $( "#navigation" ).accordion({ autoHeight: true }), 95, 130 );
|
||||
equalHeight( $( "#navigation" ).accordion({ autoHeight: true }), 105 );
|
||||
});
|
||||
|
||||
test( "{ autoHeight: false }", function() {
|
||||
@ -128,7 +128,7 @@ test( "{ fillSpace: true }", function() {
|
||||
expect( 3 );
|
||||
$( "#navigationWrapper" ).height( 500 );
|
||||
var element = $( "#navigation" ).accordion({ fillSpace: true });
|
||||
equalHeights( element, 446, 458 );
|
||||
equalHeight( element, 455 );
|
||||
});
|
||||
|
||||
test( "{ fillSapce: true } with sibling", function() {
|
||||
@ -142,7 +142,7 @@ test( "{ fillSapce: true } with sibling", function() {
|
||||
})
|
||||
.prependTo( "#navigationWrapper" );
|
||||
var element = $( "#navigation" ).accordion({ fillSpace: true });
|
||||
equalHeights( element , 346, 358);
|
||||
equalHeight( element , 355 );
|
||||
});
|
||||
|
||||
test( "{ fillSpace: true } with multiple siblings", function() {
|
||||
@ -171,7 +171,7 @@ test( "{ fillSpace: true } with multiple siblings", function() {
|
||||
})
|
||||
.prependTo( "#navigationWrapper" );
|
||||
var element = $( "#navigation" ).accordion({ fillSpace: true });
|
||||
equalHeights( element, 296, 308 );
|
||||
equalHeight( element, 305 );
|
||||
});
|
||||
|
||||
|
||||
@ -206,11 +206,11 @@ test( "resize", function() {
|
||||
.accordion({
|
||||
heightStyle: "fill"
|
||||
});
|
||||
equalHeights( element, 246, 258 );
|
||||
equalHeight( element, 255 );
|
||||
|
||||
element.parent().height( 500 );
|
||||
element.accordion( "resize" );
|
||||
equalHeights( element, 446, 458 );
|
||||
equalHeight( element, 455 );
|
||||
});
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
(function( $ ) {
|
||||
|
||||
var equalHeights = TestHelpers.accordion.equalHeights,
|
||||
var equalHeight = TestHelpers.accordion.equalHeight,
|
||||
setupTeardown = TestHelpers.accordion.setupTeardown,
|
||||
state = TestHelpers.accordion.state;
|
||||
|
||||
@ -38,11 +38,11 @@ test( "refresh", function() {
|
||||
.accordion({
|
||||
heightStyle: "fill"
|
||||
});
|
||||
equalHeights( element, 246, 258 );
|
||||
equalHeight( element, 255 );
|
||||
|
||||
element.parent().height( 500 );
|
||||
element.accordion( "refresh" );
|
||||
equalHeights( element, 446, 458 );
|
||||
equalHeight( element, 455 );
|
||||
});
|
||||
|
||||
}( jQuery ) );
|
||||
|
@ -1,6 +1,6 @@
|
||||
(function( $ ) {
|
||||
|
||||
var equalHeights = TestHelpers.accordion.equalHeights,
|
||||
var equalHeight = TestHelpers.accordion.equalHeight,
|
||||
setupTeardown = TestHelpers.accordion.setupTeardown,
|
||||
state = TestHelpers.accordion.state;
|
||||
|
||||
@ -359,7 +359,7 @@ test( "{ header: custom }", function() {
|
||||
test( "{ heightStyle: 'auto' }", function() {
|
||||
expect( 3 );
|
||||
var element = $( "#navigation" ).accordion({ heightStyle: "auto" });
|
||||
equalHeights( element, 95, 130 );
|
||||
equalHeight( element, 105 );
|
||||
});
|
||||
|
||||
test( "{ heightStyle: 'content' }", function() {
|
||||
@ -377,7 +377,7 @@ test( "{ heightStyle: 'fill' }", function() {
|
||||
expect( 3 );
|
||||
$( "#navigationWrapper" ).height( 500 );
|
||||
var element = $( "#navigation" ).accordion({ heightStyle: "fill" });
|
||||
equalHeights( element, 446, 458 );
|
||||
equalHeight( element, 455 );
|
||||
});
|
||||
|
||||
test( "{ heightStyle: 'fill' } with sibling", function() {
|
||||
@ -391,7 +391,7 @@ test( "{ heightStyle: 'fill' } with sibling", function() {
|
||||
})
|
||||
.prependTo( "#navigationWrapper" );
|
||||
var element = $( "#navigation" ).accordion({ heightStyle: "fill" });
|
||||
equalHeights( element , 346, 358);
|
||||
equalHeight( element , 355 );
|
||||
});
|
||||
|
||||
test( "{ heightStyle: 'fill' } with multiple siblings", function() {
|
||||
@ -420,7 +420,7 @@ test( "{ heightStyle: 'fill' } with multiple siblings", function() {
|
||||
})
|
||||
.prependTo( "#navigationWrapper" );
|
||||
var element = $( "#navigation" ).accordion({ heightStyle: "fill" });
|
||||
equalHeights( element, 296, 308 );
|
||||
equalHeight( element, 305 );
|
||||
});
|
||||
|
||||
test( "{ icons: false }", function() {
|
||||
|
@ -1,13 +1,8 @@
|
||||
TestHelpers.accordion = {
|
||||
equalHeights: function( accordion, min, max ) {
|
||||
var sizes = [];
|
||||
equalHeight: function( accordion, height ) {
|
||||
accordion.find( ".ui-accordion-content" ).each(function() {
|
||||
sizes.push( $( this ).outerHeight() );
|
||||
equal( $( this ).outerHeight(), height );
|
||||
});
|
||||
ok( sizes[ 0 ] >= min && sizes[ 0 ] <= max,
|
||||
"must be within " + min + " and " + max + ", was " + sizes[ 0 ] );
|
||||
deepEqual( sizes[ 0 ], sizes[ 1 ] );
|
||||
deepEqual( sizes[ 0 ], sizes[ 2 ] );
|
||||
},
|
||||
|
||||
setupTeardown: function() {
|
||||
|
Loading…
Reference in New Issue
Block a user