aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDavid Petersen <public@petersendidit.com>2011-03-26 20:37:26 -0400
committerDavid Petersen <public@petersendidit.com>2011-03-26 21:02:17 -0400
commit8b89febbbb4d2f13c67bc8ec406b68ff29da3a5a (patch)
treed012412b04526df481a8d14ea7695f3b41ba5bbc /tests
parent03eb54b37902db771accd3a53bad1b927c058bc7 (diff)
downloadjquery-ui-8b89febbbb4d2f13c67bc8ec406b68ff29da3a5a.tar.gz
jquery-ui-8b89febbbb4d2f13c67bc8ec406b68ff29da3a5a.zip
Tabs: split up _tabify, create refresh method. Fixes #7140 Tabs: Add refresh method
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/tabs/tabs_methods.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/unit/tabs/tabs_methods.js b/tests/unit/tabs/tabs_methods.js
index 44c91d492..50b8abd27 100644
--- a/tests/unit/tabs/tabs_methods.js
+++ b/tests/unit/tabs/tabs_methods.js
@@ -159,6 +159,34 @@ test('select', function() {
equals(el.tabs('option', 'selected'), 1, 'should select tab by id');
});
+test('refresh', function() {
+ expect(5);
+
+ var el = $('<div id="tabs"><ul></ul></div>').tabs(),
+ ul = el.find('ul');
+
+ equals(el.tabs('option', 'selected'), -1, 'Initially empty, no selected tab');
+
+ ul.append('<li><a href="data/test.html">Test 1</a></li>');
+ el.tabs('refresh');
+ equals( el.find('.ui-tabs-panel').length, 1, 'Panel created after refresh');
+
+ ul.find('li').remove();
+ el.tabs('refresh');
+ equals( el.find('.ui-tabs-panel').length, 0, 'Panel removed after refresh');
+
+ ul.append('<li><a href="#test1">Test 1</a></li>');
+ $('<div id="test1">Test Panel 1</div>').insertAfter( ul );
+ el.tabs('refresh');
+ el.tabs('select', 0);
+ equals( el.tabs('option', 'selected'), 0, 'First tab added should be auto selected');
+
+ ul.append('<li><a href="#test2">Test 2</a></li>');
+ $('<div id="test2">Test Panel 2</div>').insertAfter( ul );
+ el.tabs('refresh');
+ equals( el.tabs('option', 'selected'), 0, 'Second tab added should not be auto selected');
+});
+
test('load', function() {
ok(false, "missing test - untested code is broken code.");
});