mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Accordion: Deprecated icons.headerSelected in favor of icons.activeHeader. Fixes #6834 - Accordion: Change icons.headerSelected to icons.activeHeader.
This commit is contained in:
parent
04667b1518
commit
b6ed9328ef
@ -13,7 +13,9 @@ var accordion_defaults = {
|
|||||||
fillSpace: false,
|
fillSpace: false,
|
||||||
header: "> li > :first-child,> :not(li):even",
|
header: "> li > :first-child,> :not(li):even",
|
||||||
heightStyle: null,
|
heightStyle: null,
|
||||||
icons: { "header": "ui-icon-triangle-1-e", "headerSelected": "ui-icon-triangle-1-s" },
|
icons: { "header": "ui-icon-triangle-1-e",
|
||||||
|
"activeHeader": null,
|
||||||
|
"headerSelected": "ui-icon-triangle-1-s" },
|
||||||
navigation: false,
|
navigation: false,
|
||||||
navigationFilter: function() {}
|
navigationFilter: function() {}
|
||||||
};
|
};
|
||||||
|
@ -163,6 +163,15 @@ test("{ icons: false }", function() {
|
|||||||
icons(false);
|
icons(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("{ icons: { activeHeader : 'test' } }", function() {
|
||||||
|
var list = $("#list1");
|
||||||
|
list.accordion( { icons: { "activeHeader": "test" } } );
|
||||||
|
equals( $( "#list1 span.test" ).length, 1);
|
||||||
|
list.accordion("option", "icons", { "activeHeader": "news" } );
|
||||||
|
equals( $( "#list1 span.test" ).length, 0);
|
||||||
|
equals( $( "#list1 span.news" ).length, 1);
|
||||||
|
});
|
||||||
|
|
||||||
test("{ navigation: true, navigationFilter: header }", function() {
|
test("{ navigation: true, navigationFilter: header }", function() {
|
||||||
$("#navigation").accordion({
|
$("#navigation").accordion({
|
||||||
navigation: true,
|
navigation: true,
|
||||||
@ -183,4 +192,12 @@ test("{ navigation: true, navigationFilter: content }", function() {
|
|||||||
equals( $("#navigation .ui-accordion-content:eq(2)").size(), 1, "third content active" );
|
equals( $("#navigation .ui-accordion-content:eq(2)").size(), 1, "third content active" );
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("change headerSelected option after creation", function() {
|
||||||
|
var list = $("#list1");
|
||||||
|
list.accordion( { icons: { "activeHeader": "test" } } );
|
||||||
|
equals( $( "#list1 span.test" ).length, 1);
|
||||||
|
list.accordion( "option", "icons", { "headerSelected": "deprecated" } );
|
||||||
|
equals( $( "#list1 span.deprecated" ).length, 1);
|
||||||
|
});
|
||||||
|
|
||||||
})(jQuery);
|
})(jQuery);
|
||||||
|
25
ui/jquery.ui.accordion.js
vendored
25
ui/jquery.ui.accordion.js
vendored
@ -24,7 +24,8 @@ $.widget( "ui.accordion", {
|
|||||||
heightStyle: null, // "auto"
|
heightStyle: null, // "auto"
|
||||||
icons: {
|
icons: {
|
||||||
header: "ui-icon-triangle-1-e",
|
header: "ui-icon-triangle-1-e",
|
||||||
headerSelected: "ui-icon-triangle-1-s"
|
// TODO: set to "ui-icon-triangle-1-s" in 2.0 (#6835)
|
||||||
|
activeHeader: null // "ui-icon-triangle-1-s"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -133,7 +134,7 @@ $.widget( "ui.accordion", {
|
|||||||
.prependTo( this.headers );
|
.prependTo( this.headers );
|
||||||
this.active.children( ".ui-icon" )
|
this.active.children( ".ui-icon" )
|
||||||
.toggleClass(options.icons.header)
|
.toggleClass(options.icons.header)
|
||||||
.toggleClass(options.icons.headerSelected);
|
.toggleClass(options.icons.activeHeader);
|
||||||
this.element.addClass( "ui-accordion-icons" );
|
this.element.addClass( "ui-accordion-icons" );
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -307,7 +308,7 @@ $.widget( "ui.accordion", {
|
|||||||
.removeClass( "ui-state-active ui-corner-top" )
|
.removeClass( "ui-state-active ui-corner-top" )
|
||||||
.addClass( "ui-state-default ui-corner-all" )
|
.addClass( "ui-state-default ui-corner-all" )
|
||||||
.children( ".ui-icon" )
|
.children( ".ui-icon" )
|
||||||
.removeClass( options.icons.headerSelected )
|
.removeClass( options.icons.activeHeader )
|
||||||
.addClass( options.icons.header );
|
.addClass( options.icons.header );
|
||||||
this.active.next().addClass( "ui-accordion-content-active" );
|
this.active.next().addClass( "ui-accordion-content-active" );
|
||||||
var toHide = this.active.next(),
|
var toHide = this.active.next(),
|
||||||
@ -361,7 +362,7 @@ $.widget( "ui.accordion", {
|
|||||||
.removeClass( "ui-state-active ui-corner-top" )
|
.removeClass( "ui-state-active ui-corner-top" )
|
||||||
.addClass( "ui-state-default ui-corner-all" )
|
.addClass( "ui-state-default ui-corner-all" )
|
||||||
.children( ".ui-icon" )
|
.children( ".ui-icon" )
|
||||||
.removeClass( options.icons.headerSelected )
|
.removeClass( options.icons.activeHeader )
|
||||||
.addClass( options.icons.header );
|
.addClass( options.icons.header );
|
||||||
if ( !clickedIsActive ) {
|
if ( !clickedIsActive ) {
|
||||||
clicked
|
clicked
|
||||||
@ -369,7 +370,7 @@ $.widget( "ui.accordion", {
|
|||||||
.addClass( "ui-state-active ui-corner-top" )
|
.addClass( "ui-state-active ui-corner-top" )
|
||||||
.children( ".ui-icon" )
|
.children( ".ui-icon" )
|
||||||
.removeClass( options.icons.header )
|
.removeClass( options.icons.header )
|
||||||
.addClass( options.icons.headerSelected );
|
.addClass( options.icons.activeHeader );
|
||||||
clicked
|
clicked
|
||||||
.next()
|
.next()
|
||||||
.addClass( "ui-accordion-content-active" );
|
.addClass( "ui-accordion-content-active" );
|
||||||
@ -626,6 +627,7 @@ $.extend( $.ui.accordion, {
|
|||||||
};
|
};
|
||||||
}( jQuery, jQuery.ui.accordion.prototype ) );
|
}( jQuery, jQuery.ui.accordion.prototype ) );
|
||||||
|
|
||||||
|
// height options
|
||||||
(function( $, prototype ) {
|
(function( $, prototype ) {
|
||||||
$.extend( prototype.options, {
|
$.extend( prototype.options, {
|
||||||
autoHeight: true, // use heightStyle: "auto"
|
autoHeight: true, // use heightStyle: "auto"
|
||||||
@ -640,6 +642,7 @@ $.extend( $.ui.accordion, {
|
|||||||
_create: function() {
|
_create: function() {
|
||||||
this.options.heightStyle = this.options.heightStyle ||
|
this.options.heightStyle = this.options.heightStyle ||
|
||||||
this._mergeHeightStyle();
|
this._mergeHeightStyle();
|
||||||
|
|
||||||
_create.call( this );
|
_create.call( this );
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -668,4 +671,16 @@ $.extend( $.ui.accordion, {
|
|||||||
});
|
});
|
||||||
}( jQuery, jQuery.ui.accordion.prototype ) );
|
}( jQuery, jQuery.ui.accordion.prototype ) );
|
||||||
|
|
||||||
|
// icon options
|
||||||
|
(function( $, prototype ) {
|
||||||
|
prototype.options.icons.headerSelected = "ui-icon-triangle-1-s";
|
||||||
|
|
||||||
|
var _createIcons = prototype._createIcons;
|
||||||
|
prototype._createIcons = function() {
|
||||||
|
this.options.icons.activeHeader = this.options.icons.activeHeader ||
|
||||||
|
this.options.icons.headerSelected;
|
||||||
|
_createIcons.call( this );
|
||||||
|
};
|
||||||
|
}( jQuery, jQuery.ui.accordion.prototype ) );
|
||||||
|
|
||||||
})( jQuery );
|
})( jQuery );
|
||||||
|
Loading…
Reference in New Issue
Block a user