diff options
author | Klaus Hartl <klaus.hartl@googlemail.com> | 2009-01-18 21:09:31 +0000 |
---|---|---|
committer | Klaus Hartl <klaus.hartl@googlemail.com> | 2009-01-18 21:09:31 +0000 |
commit | 941f6feede6489024dc77a03065c59ac49231fa7 (patch) | |
tree | d9e7dd045578d58f2eefd0c2295459eceaeee302 | |
parent | 6b887b5efd931fbc2e13056da904a5f22870bc1d (diff) | |
download | jquery-ui-941f6feede6489024dc77a03065c59ac49231fa7.tar.gz jquery-ui-941f6feede6489024dc77a03065c59ac49231fa7.zip |
UI Tabs: fixed incomplete destroy method, fixes #3798
-rw-r--r-- | tests/unit/tabs/tabs.js | 22 | ||||
-rw-r--r-- | ui/ui.tabs.js | 10 |
2 files changed, 29 insertions, 3 deletions
diff --git a/tests/unit/tabs/tabs.js b/tests/unit/tabs/tabs.js index ed0d92b10..8ea8db764 100644 --- a/tests/unit/tabs/tabs.js +++ b/tests/unit/tabs/tabs.js @@ -55,7 +55,25 @@ module('tabs'); }); 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'); - test('id containing colon, #????', function() { + test('id containing colon, #2715', function() { // http://ui.jquery.com/bugs/ticket/2715 expect(4); var el = $('#tabs2 > ul').tabs(); diff --git a/ui/ui.tabs.js b/ui/ui.tabs.js index 34438e55d..9c3243ee1 100644 --- a/ui/ui.tabs.js +++ b/ui/ui.tabs.js @@ -21,8 +21,14 @@ $.widget("ui.tabs", { destroy: function() { var o = this.options; + + this.element + .removeClass('ui-tabs ui-widget ui-widget-content ui-corner-all'); + 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() { var href = $.data(this, 'href.tabs'); if (href) @@ -32,6 +38,7 @@ $.widget("ui.tabs", { $this.removeData(prefix + '.tabs'); }); }); + this.$lis.unbind('.tabs').add(this.$panels).each(function() { if ($.data(this, 'destroy.tabs')) $(this).remove(); @@ -48,6 +55,7 @@ $.widget("ui.tabs", { 'ui-corner-bottom ' + 'ui-tabs-hide'); }); + if (o.cookie) this._cookie(null, o.cookie); }, |