mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Tabs: few fixes required in destroy method, removed ol as tabifyable element
This commit is contained in:
parent
676ea7f248
commit
240a588bce
@ -22,16 +22,18 @@ test('init', function() {
|
||||
});
|
||||
|
||||
test('destroy', function() {
|
||||
expect(5);
|
||||
expect(6);
|
||||
|
||||
el = $('#tabs1').tabs();
|
||||
el = $('#tabs1').tabs({ collapsible: true });
|
||||
$('li:eq(2)', el).simulate('mouseover').find('a').focus();
|
||||
el.tabs('destroy');
|
||||
|
||||
ok( el.is(':not(.ui-tabs, .ui-widget, .ui-widget-content, .ui-corner-all)'), 'remove classes from container');
|
||||
ok( el.is(':not(.ui-tabs, .ui-widget, .ui-widget-content, .ui-corner-all, .ui-tabs-collapsible)'), 'remove classes from container');
|
||||
ok( $('ul', el).is(':not(.ui-tabs-nav, .ui-helper-reset, .ui-helper-clearfix, .ui-widget-header, .ui-corner-all)'), 'remove classes from list' );
|
||||
ok( $('div:eq(1)', el).is(':not(.ui-tabs-panel, .ui-widget-content, .ui-corner-bottom, .ui-tabs-hide)'), 'remove classes to panel' );
|
||||
ok( $('li:eq(0)', el).is(':not(.ui-tabs-selected, .ui-state-active, .ui-corner-top)'), 'remove classes from active li');
|
||||
ok( $('li:eq(1)', el).is(':not(.ui-state-default, .ui-corner-top)'), 'remove classes from inactive li');
|
||||
ok( $('li:eq(2)', el).is(':not(.ui-state-hover, .ui-state-focus)'), 'remove classes from mouseovered or focused li');
|
||||
});
|
||||
|
||||
test('enable', function() {
|
||||
|
@ -65,13 +65,13 @@ $.widget("ui.tabs", {
|
||||
.find('span:data(label.tabs)')
|
||||
.each(function() {
|
||||
var el = $(this);
|
||||
el.html(el.data('label.tabs'));
|
||||
el.html(el.data('label.tabs')).removeData('label.tabs');
|
||||
});
|
||||
},
|
||||
|
||||
_tabify: function(init) {
|
||||
|
||||
this.list = this.element.children('ul:first, ol:first').eq(0);
|
||||
this.list = this.element.children('ul:first');
|
||||
this.lis = $('li:has(a[href])', this.list);
|
||||
this.anchors = this.lis.map(function() { return $('a', this)[0]; });
|
||||
this.panels = $([]);
|
||||
@ -391,8 +391,10 @@ $.widget("ui.tabs", {
|
||||
destroy: function() {
|
||||
var o = this.options;
|
||||
|
||||
this.abort();
|
||||
|
||||
this.element.unbind('.tabs')
|
||||
.removeClass('ui-tabs ui-widget ui-widget-content ui-corner-all')
|
||||
.removeClass('ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible')
|
||||
.removeData('tabs');
|
||||
|
||||
this.list.removeClass('ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all');
|
||||
@ -413,18 +415,19 @@ $.widget("ui.tabs", {
|
||||
$(this).remove();
|
||||
}
|
||||
else {
|
||||
$(this).removeClass(
|
||||
'ui-state-default ' +
|
||||
'ui-corner-top ' +
|
||||
'ui-tabs-selected ' +
|
||||
'ui-state-active ' +
|
||||
'ui-state-hover ' +
|
||||
'ui-tabs-collapsible ' +
|
||||
'ui-state-disabled ' +
|
||||
'ui-tabs-panel ' +
|
||||
'ui-widget-content ' +
|
||||
'ui-corner-bottom ' +
|
||||
'ui-tabs-hide');
|
||||
$(this).removeClass([
|
||||
'ui-state-default',
|
||||
'ui-corner-top',
|
||||
'ui-tabs-selected',
|
||||
'ui-state-active',
|
||||
'ui-state-hover',
|
||||
'ui-state-focus',
|
||||
'ui-state-disabled',
|
||||
'ui-tabs-panel',
|
||||
'ui-widget-content',
|
||||
'ui-corner-bottom',
|
||||
'ui-tabs-hide'
|
||||
].join(' '));
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user