mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
Accordion: Remove deprecated height options. Fixes #5868 - Accordion: Remove clearStyle option. Fixes #5872 - Accordion: Remove autoHeight and fillSpace options.
This commit is contained in:
parent
d07074dc3c
commit
0cdd5591be
@ -3,14 +3,11 @@ TestHelpers.commonWidgetTests( "accordion", {
|
||||
active: 0,
|
||||
animate: null,
|
||||
animated: "slide",
|
||||
autoHeight: true,
|
||||
clearStyle: false,
|
||||
collapsible: false,
|
||||
disabled: false,
|
||||
event: "click",
|
||||
fillSpace: false,
|
||||
header: "> li > :first-child,> :not(li):even",
|
||||
heightStyle: null,
|
||||
heightStyle: "auto",
|
||||
icons: {
|
||||
"activeHeader": null,
|
||||
"header": "ui-icon-triangle-1-e",
|
||||
|
@ -104,80 +104,6 @@ test( "{ active: jQuery Object }", function() {
|
||||
|
||||
|
||||
|
||||
|
||||
module( "accordion (deprecated) - height options", setupTeardown() );
|
||||
|
||||
test( "{ autoHeight: true }, default", function() {
|
||||
expect( 3 );
|
||||
equalHeight( $( "#navigation" ).accordion({ autoHeight: true }), 105 );
|
||||
});
|
||||
|
||||
test( "{ autoHeight: false }", function() {
|
||||
expect( 3 );
|
||||
var element = $( "#navigation" ).accordion({ autoHeight: false }),
|
||||
sizes = [];
|
||||
element.find( ".ui-accordion-content" ).each(function() {
|
||||
sizes.push( $(this).height() );
|
||||
});
|
||||
ok( sizes[0] >= 70 && sizes[0] <= 105, "was " + sizes[0] );
|
||||
ok( sizes[1] >= 98 && sizes[1] <= 126, "was " + sizes[1] );
|
||||
ok( sizes[2] >= 42 && sizes[2] <= 54, "was " + sizes[2] );
|
||||
});
|
||||
|
||||
test( "{ fillSpace: true }", function() {
|
||||
expect( 3 );
|
||||
$( "#navigationWrapper" ).height( 500 );
|
||||
var element = $( "#navigation" ).accordion({ fillSpace: true });
|
||||
equalHeight( element, 455 );
|
||||
});
|
||||
|
||||
test( "{ fillSapce: true } with sibling", function() {
|
||||
expect( 3 );
|
||||
$( "#navigationWrapper" ).height( 500 );
|
||||
$( "<p>Lorem Ipsum</p>" )
|
||||
.css({
|
||||
height: 50,
|
||||
marginTop: 20,
|
||||
marginBottom: 30
|
||||
})
|
||||
.prependTo( "#navigationWrapper" );
|
||||
var element = $( "#navigation" ).accordion({ fillSpace: true });
|
||||
equalHeight( element , 355 );
|
||||
});
|
||||
|
||||
test( "{ fillSpace: true } with multiple siblings", function() {
|
||||
expect( 3 );
|
||||
$( "#navigationWrapper" ).height( 500 );
|
||||
$( "<p>Lorem Ipsum</p>" )
|
||||
.css({
|
||||
height: 50,
|
||||
marginTop: 20,
|
||||
marginBottom: 30
|
||||
})
|
||||
.prependTo( "#navigationWrapper" );
|
||||
$( "<p>Lorem Ipsum</p>" )
|
||||
.css({
|
||||
height: 50,
|
||||
marginTop: 20,
|
||||
marginBottom: 30,
|
||||
position: "absolute"
|
||||
})
|
||||
.prependTo( "#navigationWrapper" );
|
||||
$( "<p>Lorem Ipsum</p>" )
|
||||
.css({
|
||||
height: 25,
|
||||
marginTop: 10,
|
||||
marginBottom: 15
|
||||
})
|
||||
.prependTo( "#navigationWrapper" );
|
||||
var element = $( "#navigation" ).accordion({ fillSpace: true });
|
||||
equalHeight( element, 305 );
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
module( "accordion (deprecated) - icons", setupTeardown() );
|
||||
|
||||
test( "icons, headerSelected", function() {
|
||||
|
45
ui/jquery.ui.accordion.js
vendored
45
ui/jquery.ui.accordion.js
vendored
@ -576,51 +576,6 @@ if ( $.uiBackCompat !== false ) {
|
||||
};
|
||||
}( jQuery, jQuery.ui.accordion.prototype ) );
|
||||
|
||||
// height options
|
||||
(function( $, prototype ) {
|
||||
$.extend( prototype.options, {
|
||||
heightStyle: null, // remove default so we fall back to old values
|
||||
autoHeight: true, // use heightStyle: "auto"
|
||||
clearStyle: false, // use heightStyle: "content"
|
||||
fillSpace: false // use heightStyle: "fill"
|
||||
});
|
||||
|
||||
var _create = prototype._create,
|
||||
_setOption = prototype._setOption;
|
||||
|
||||
$.extend( prototype, {
|
||||
_create: function() {
|
||||
this.options.heightStyle = this.options.heightStyle ||
|
||||
this._mergeHeightStyle();
|
||||
|
||||
_create.call( this );
|
||||
},
|
||||
|
||||
_setOption: function( key ) {
|
||||
if ( key === "autoHeight" || key === "clearStyle" || key === "fillSpace" ) {
|
||||
this.options.heightStyle = this._mergeHeightStyle();
|
||||
}
|
||||
_setOption.apply( this, arguments );
|
||||
},
|
||||
|
||||
_mergeHeightStyle: function() {
|
||||
var options = this.options;
|
||||
|
||||
if ( options.fillSpace ) {
|
||||
return "fill";
|
||||
}
|
||||
|
||||
if ( options.clearStyle ) {
|
||||
return "content";
|
||||
}
|
||||
|
||||
if ( options.autoHeight ) {
|
||||
return "auto";
|
||||
}
|
||||
}
|
||||
});
|
||||
}( jQuery, jQuery.ui.accordion.prototype ) );
|
||||
|
||||
// icon options
|
||||
(function( $, prototype ) {
|
||||
$.extend( prototype.options.icons, {
|
||||
|
Loading…
Reference in New Issue
Block a user