mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
UI Tabs: fixed incomplete destroy method, fixes #3798
This commit is contained in:
parent
6b887b5efd
commit
941f6feede
@ -55,7 +55,25 @@ module('tabs');
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('destroy', function() {
|
test('destroy', function() {
|
||||||
expect(0);
|
expect(14);
|
||||||
|
|
||||||
|
var el = $('#tabs1').tabs(); // new markup requires to tabify wrapper again...
|
||||||
|
el.tabs('destroy');
|
||||||
|
|
||||||
|
ok( el.is(':not(.ui-tabs)'), 'remove classes from container');
|
||||||
|
ok( el.is(':not(.ui-widget)'), 'remove classes from container');
|
||||||
|
ok( el.is(':not(.ui-widget-content)'), 'remove classes from container');
|
||||||
|
ok( el.is(':not(.ui-corner-all)'), 'remove classes from container');
|
||||||
|
ok( $('ul', el).is(':not(.ui-tabs-nav)'), 'remove classes from list' );
|
||||||
|
ok( $('ul', el).is(':not(.ui-helper-reset)'), 'remove classes from list' );
|
||||||
|
ok( $('ul', el).is(':not(.ui-helper-clearfix)'), 'remove classes from list' );
|
||||||
|
ok( $('ul', el).is(':not(.ui-widget-header)'), 'remove classes from list' );
|
||||||
|
ok( $('ul', el).is(':not(.ui-corner-all)'), 'remove classes from list' );
|
||||||
|
ok( $('li:eq(0)', el).is(':not(.ui-tabs-selected)'), 'remove classes from active li');
|
||||||
|
ok( $('li:eq(0)', el).is(':not(.ui-state-active)'), 'remove classes from active li');
|
||||||
|
ok( $('li:eq(0)', el).is(':not(.ui-corner-top)'), 'remove classes from active li');
|
||||||
|
ok( $('li:eq(1)', el).is(':not(.ui-state-default)'), 'remove classes from inactive li');
|
||||||
|
ok( $('li:eq(1)', el).is(':not(.ui-corner-top)'), 'remove classes from inactive li');
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -189,7 +207,7 @@ module('tabs: Options');
|
|||||||
|
|
||||||
module('tabs: Tickets');
|
module('tabs: Tickets');
|
||||||
|
|
||||||
test('id containing colon, #????', function() {
|
test('id containing colon, #2715', function() { // http://ui.jquery.com/bugs/ticket/2715
|
||||||
expect(4);
|
expect(4);
|
||||||
|
|
||||||
var el = $('#tabs2 > ul').tabs();
|
var el = $('#tabs2 > ul').tabs();
|
||||||
|
@ -21,8 +21,14 @@ $.widget("ui.tabs", {
|
|||||||
|
|
||||||
destroy: function() {
|
destroy: function() {
|
||||||
var o = this.options;
|
var o = this.options;
|
||||||
|
|
||||||
|
this.element
|
||||||
|
.removeClass('ui-tabs ui-widget ui-widget-content ui-corner-all');
|
||||||
|
|
||||||
this.list.unbind('.tabs')
|
this.list.unbind('.tabs')
|
||||||
.removeClass('ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all').removeData('tabs');
|
.removeClass('ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all')
|
||||||
|
.removeData('tabs');
|
||||||
|
|
||||||
this.$tabs.each(function() {
|
this.$tabs.each(function() {
|
||||||
var href = $.data(this, 'href.tabs');
|
var href = $.data(this, 'href.tabs');
|
||||||
if (href)
|
if (href)
|
||||||
@ -32,6 +38,7 @@ $.widget("ui.tabs", {
|
|||||||
$this.removeData(prefix + '.tabs');
|
$this.removeData(prefix + '.tabs');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
this.$lis.unbind('.tabs').add(this.$panels).each(function() {
|
this.$lis.unbind('.tabs').add(this.$panels).each(function() {
|
||||||
if ($.data(this, 'destroy.tabs'))
|
if ($.data(this, 'destroy.tabs'))
|
||||||
$(this).remove();
|
$(this).remove();
|
||||||
@ -48,6 +55,7 @@ $.widget("ui.tabs", {
|
|||||||
'ui-corner-bottom ' +
|
'ui-corner-bottom ' +
|
||||||
'ui-tabs-hide');
|
'ui-tabs-hide');
|
||||||
});
|
});
|
||||||
|
|
||||||
if (o.cookie)
|
if (o.cookie)
|
||||||
this._cookie(null, o.cookie);
|
this._cookie(null, o.cookie);
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user