aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/tabs
diff options
context:
space:
mode:
authorDavid Petersen <public@petersendidit.com>2011-04-17 21:09:47 -0400
committerScott González <scott.gonzalez@gmail.com>2011-04-28 09:37:56 -0400
commit0e7769c66958a0f86ffda0209caa4039d96c79b2 (patch)
tree8684775829fa724f21bd0ce322d5ed880f261135 /tests/unit/tabs
parentabe4c37748628d17627493070abddbd8084b3b36 (diff)
downloadjquery-ui-0e7769c66958a0f86ffda0209caa4039d96c79b2.tar.gz
jquery-ui-0e7769c66958a0f86ffda0209caa4039d96c79b2.zip
Tabs: enable/disable handle when current state already matches, fix error when disabled = true and enable gets called
Diffstat (limited to 'tests/unit/tabs')
-rw-r--r--tests/unit/tabs/tabs_methods.js22
1 files changed, 20 insertions, 2 deletions
diff --git a/tests/unit/tabs/tabs_methods.js b/tests/unit/tabs/tabs_methods.js
index 7c72cd26d..bd28316c5 100644
--- a/tests/unit/tabs/tabs_methods.js
+++ b/tests/unit/tabs/tabs_methods.js
@@ -18,7 +18,7 @@ test('destroy', function() {
});
test('enable', function() {
- expect(8);
+ expect(12);
el = $('#tabs1').tabs({ disabled: [ 0, 1 ] });
el.tabs("enable", 1);
@@ -31,6 +31,18 @@ test('enable', function() {
ok( !$('li.ui-state-disabled', el).length, 'enable all');
same(el.tabs('option', 'disabled'), false, 'update property');
+ // enable one tab
+ el.tabs({ disabled: true });
+ el.tabs("enable", 1);
+ ok( $('li:eq(1)', el).is(':not(.ui-state-disabled)'), 'remove class from li');
+ same(el.tabs('option', 'disabled'), [ 0, 2 ], 'update property');
+
+ // all tabs already enabled
+ el.tabs({ disabled: false });
+ el.tabs("enable", 1);
+ ok( !$('li.ui-state-disabled', el).length, 'enable all');
+ same(el.tabs('option', 'disabled'), false, 'update property');
+
el.tabs('destroy');
// enable all tabs one by one
el.tabs({ disabled: [ 1, 2 ] });
@@ -43,7 +55,7 @@ test('enable', function() {
});
test('disable', function() {
- expect(12);
+ expect(14);
// normal
el = $('#tabs1').tabs();
@@ -61,6 +73,12 @@ test('disable', function() {
same( $('li.ui-state-disabled', el).length, 3, 'disable all');
same(el.tabs('option', 'disabled'), true, 'set to true');
+ // all tabs already disabled
+ el.tabs({ disabled: true });
+ el.tabs("disable", 1);
+ ok( $('li.ui-state-disabled', el).length, 'disable all');
+ same(el.tabs('option', 'disabled'), true, 'set to true');
+
el.tabs("destroy");
// disable all tabs one by one
el.tabs();