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( $ ) {
|
(function( $ ) {
|
||||||
|
|
||||||
var equalHeights = TestHelpers.accordion.equalHeights,
|
var equalHeight = TestHelpers.accordion.equalHeight,
|
||||||
setupTeardown = TestHelpers.accordion.setupTeardown,
|
setupTeardown = TestHelpers.accordion.setupTeardown,
|
||||||
state = TestHelpers.accordion.state;
|
state = TestHelpers.accordion.state;
|
||||||
|
|
||||||
@ -109,7 +109,7 @@ module( "accordion (deprecated) - height options", setupTeardown() );
|
|||||||
|
|
||||||
test( "{ autoHeight: true }, default", function() {
|
test( "{ autoHeight: true }, default", function() {
|
||||||
expect( 3 );
|
expect( 3 );
|
||||||
equalHeights( $( "#navigation" ).accordion({ autoHeight: true }), 95, 130 );
|
equalHeight( $( "#navigation" ).accordion({ autoHeight: true }), 105 );
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "{ autoHeight: false }", function() {
|
test( "{ autoHeight: false }", function() {
|
||||||
@ -128,7 +128,7 @@ test( "{ fillSpace: true }", function() {
|
|||||||
expect( 3 );
|
expect( 3 );
|
||||||
$( "#navigationWrapper" ).height( 500 );
|
$( "#navigationWrapper" ).height( 500 );
|
||||||
var element = $( "#navigation" ).accordion({ fillSpace: true });
|
var element = $( "#navigation" ).accordion({ fillSpace: true });
|
||||||
equalHeights( element, 446, 458 );
|
equalHeight( element, 455 );
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "{ fillSapce: true } with sibling", function() {
|
test( "{ fillSapce: true } with sibling", function() {
|
||||||
@ -142,7 +142,7 @@ test( "{ fillSapce: true } with sibling", function() {
|
|||||||
})
|
})
|
||||||
.prependTo( "#navigationWrapper" );
|
.prependTo( "#navigationWrapper" );
|
||||||
var element = $( "#navigation" ).accordion({ fillSpace: true });
|
var element = $( "#navigation" ).accordion({ fillSpace: true });
|
||||||
equalHeights( element , 346, 358);
|
equalHeight( element , 355 );
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "{ fillSpace: true } with multiple siblings", function() {
|
test( "{ fillSpace: true } with multiple siblings", function() {
|
||||||
@ -171,7 +171,7 @@ test( "{ fillSpace: true } with multiple siblings", function() {
|
|||||||
})
|
})
|
||||||
.prependTo( "#navigationWrapper" );
|
.prependTo( "#navigationWrapper" );
|
||||||
var element = $( "#navigation" ).accordion({ fillSpace: true });
|
var element = $( "#navigation" ).accordion({ fillSpace: true });
|
||||||
equalHeights( element, 296, 308 );
|
equalHeight( element, 305 );
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -206,11 +206,11 @@ test( "resize", function() {
|
|||||||
.accordion({
|
.accordion({
|
||||||
heightStyle: "fill"
|
heightStyle: "fill"
|
||||||
});
|
});
|
||||||
equalHeights( element, 246, 258 );
|
equalHeight( element, 255 );
|
||||||
|
|
||||||
element.parent().height( 500 );
|
element.parent().height( 500 );
|
||||||
element.accordion( "resize" );
|
element.accordion( "resize" );
|
||||||
equalHeights( element, 446, 458 );
|
equalHeight( element, 455 );
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
(function( $ ) {
|
(function( $ ) {
|
||||||
|
|
||||||
var equalHeights = TestHelpers.accordion.equalHeights,
|
var equalHeight = TestHelpers.accordion.equalHeight,
|
||||||
setupTeardown = TestHelpers.accordion.setupTeardown,
|
setupTeardown = TestHelpers.accordion.setupTeardown,
|
||||||
state = TestHelpers.accordion.state;
|
state = TestHelpers.accordion.state;
|
||||||
|
|
||||||
@ -38,11 +38,11 @@ test( "refresh", function() {
|
|||||||
.accordion({
|
.accordion({
|
||||||
heightStyle: "fill"
|
heightStyle: "fill"
|
||||||
});
|
});
|
||||||
equalHeights( element, 246, 258 );
|
equalHeight( element, 255 );
|
||||||
|
|
||||||
element.parent().height( 500 );
|
element.parent().height( 500 );
|
||||||
element.accordion( "refresh" );
|
element.accordion( "refresh" );
|
||||||
equalHeights( element, 446, 458 );
|
equalHeight( element, 455 );
|
||||||
});
|
});
|
||||||
|
|
||||||
}( jQuery ) );
|
}( jQuery ) );
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
(function( $ ) {
|
(function( $ ) {
|
||||||
|
|
||||||
var equalHeights = TestHelpers.accordion.equalHeights,
|
var equalHeight = TestHelpers.accordion.equalHeight,
|
||||||
setupTeardown = TestHelpers.accordion.setupTeardown,
|
setupTeardown = TestHelpers.accordion.setupTeardown,
|
||||||
state = TestHelpers.accordion.state;
|
state = TestHelpers.accordion.state;
|
||||||
|
|
||||||
@ -359,7 +359,7 @@ test( "{ header: custom }", function() {
|
|||||||
test( "{ heightStyle: 'auto' }", function() {
|
test( "{ heightStyle: 'auto' }", function() {
|
||||||
expect( 3 );
|
expect( 3 );
|
||||||
var element = $( "#navigation" ).accordion({ heightStyle: "auto" });
|
var element = $( "#navigation" ).accordion({ heightStyle: "auto" });
|
||||||
equalHeights( element, 95, 130 );
|
equalHeight( element, 105 );
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "{ heightStyle: 'content' }", function() {
|
test( "{ heightStyle: 'content' }", function() {
|
||||||
@ -377,7 +377,7 @@ test( "{ heightStyle: 'fill' }", function() {
|
|||||||
expect( 3 );
|
expect( 3 );
|
||||||
$( "#navigationWrapper" ).height( 500 );
|
$( "#navigationWrapper" ).height( 500 );
|
||||||
var element = $( "#navigation" ).accordion({ heightStyle: "fill" });
|
var element = $( "#navigation" ).accordion({ heightStyle: "fill" });
|
||||||
equalHeights( element, 446, 458 );
|
equalHeight( element, 455 );
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "{ heightStyle: 'fill' } with sibling", function() {
|
test( "{ heightStyle: 'fill' } with sibling", function() {
|
||||||
@ -391,7 +391,7 @@ test( "{ heightStyle: 'fill' } with sibling", function() {
|
|||||||
})
|
})
|
||||||
.prependTo( "#navigationWrapper" );
|
.prependTo( "#navigationWrapper" );
|
||||||
var element = $( "#navigation" ).accordion({ heightStyle: "fill" });
|
var element = $( "#navigation" ).accordion({ heightStyle: "fill" });
|
||||||
equalHeights( element , 346, 358);
|
equalHeight( element , 355 );
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "{ heightStyle: 'fill' } with multiple siblings", function() {
|
test( "{ heightStyle: 'fill' } with multiple siblings", function() {
|
||||||
@ -420,7 +420,7 @@ test( "{ heightStyle: 'fill' } with multiple siblings", function() {
|
|||||||
})
|
})
|
||||||
.prependTo( "#navigationWrapper" );
|
.prependTo( "#navigationWrapper" );
|
||||||
var element = $( "#navigation" ).accordion({ heightStyle: "fill" });
|
var element = $( "#navigation" ).accordion({ heightStyle: "fill" });
|
||||||
equalHeights( element, 296, 308 );
|
equalHeight( element, 305 );
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "{ icons: false }", function() {
|
test( "{ icons: false }", function() {
|
||||||
|
@ -1,13 +1,8 @@
|
|||||||
TestHelpers.accordion = {
|
TestHelpers.accordion = {
|
||||||
equalHeights: function( accordion, min, max ) {
|
equalHeight: function( accordion, height ) {
|
||||||
var sizes = [];
|
|
||||||
accordion.find( ".ui-accordion-content" ).each(function() {
|
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() {
|
setupTeardown: function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user