r2156 - in trunk: tests/unit/tabs ui
Author: klaus.hartl
Date: Sun Mar 1 06:32:29 2009
New Revision: 2156
Modified:
trunk/tests/unit/tabs/tabs_methods.js
trunk/ui/ui.tabs.js
Log:
Tabs: few fixes required in destroy method, removed ol as tabifyable element
Modified: trunk/tests/unit/tabs/tabs_methods.js
==============================================================================
--- trunk/tests/unit/tabs/tabs_methods.js (original)
+++ trunk/tests/unit/tabs/tabs_methods.js Sun Mar 1 06:32:29 2009
@@ -22,16 +22,18 @@
});
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() {
Modified: trunk/ui/ui.tabs.js
==============================================================================
--- trunk/ui/ui.tabs.js (original)
+++ trunk/ui/ui.tabs.js Sun Mar 1 06:32:29 2009
@@ -65,13 +65,13 @@
.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 @@
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 @@
$(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(' '));
}
});