aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/tabs
diff options
context:
space:
mode:
authorDavid Petersen <public@petersendidit.com>2011-03-26 16:29:57 -0400
committerDavid Petersen <public@petersendidit.com>2011-03-26 21:02:13 -0400
commite378876918361182e6cb6321159393828848b2c9 (patch)
treea2f9c25c9de4c957842013bc80d94a08f8767731 /tests/unit/tabs
parente5f081bc1c16c051665eafc22c9a7af3fba456c8 (diff)
downloadjquery-ui-e378876918361182e6cb6321159393828848b2c9.tar.gz
jquery-ui-e378876918361182e6cb6321159393828848b2c9.zip
Tabs: Deprecate add and remove methods Fixes #7141 Tabs: Deprecate add and remove methods
Diffstat (limited to 'tests/unit/tabs')
-rw-r--r--tests/unit/tabs/tabs_defaults.js2
-rw-r--r--tests/unit/tabs/tabs_deprecated.js74
-rw-r--r--tests/unit/tabs/tabs_events.js19
-rw-r--r--tests/unit/tabs/tabs_methods.js36
-rw-r--r--tests/unit/tabs/tabs_tickets.js11
5 files changed, 70 insertions, 72 deletions
diff --git a/tests/unit/tabs/tabs_defaults.js b/tests/unit/tabs/tabs_defaults.js
index 5a6bc065e..f7307b458 100644
--- a/tests/unit/tabs/tabs_defaults.js
+++ b/tests/unit/tabs/tabs_defaults.js
@@ -3,7 +3,6 @@
*/
var tabs_defaults = {
- add: null,
beforeload: null,
collapsible: false,
cookie: null,
@@ -13,7 +12,6 @@ var tabs_defaults = {
idPrefix: "ui-tabs-",
load: null,
panelTemplate: "<div></div>",
- remove: null,
select: null,
show: null,
tabTemplate: "<li><a href='#{href}'><span>#{label}</span></a></li>"
diff --git a/tests/unit/tabs/tabs_deprecated.js b/tests/unit/tabs/tabs_deprecated.js
index ee2dbdc74..b385a33c2 100644
--- a/tests/unit/tabs/tabs_deprecated.js
+++ b/tests/unit/tabs/tabs_deprecated.js
@@ -1,6 +1,6 @@
(function( $ ) {
-module("tabs (deprecated): cache and ajaxoptions");
+module("tabs (deprecated): options");
test('ajaxOptions', function() {
ok(false, "missing test - untested code is broken code.");
@@ -10,8 +10,6 @@ test('cache', function() {
ok(false, "missing test - untested code is broken code.");
});
-module("tabs (deprecated): spinner");
-
test('spinner', function() {
expect(4);
stop();
@@ -41,7 +39,7 @@ test('spinner', function() {
});
});
-module("tabs (deprecated): enable/disable events");
+module("tabs (deprecated): events");
test('enable', function() {
expect(4);
@@ -76,4 +74,72 @@ test('disable', function() {
equals(uiObj.index, 1, 'contain index');
});
+test('add', function() {
+
+ // TODO move to methods, not at all event related...
+
+ var el = $('<div id="tabs"><ul></ul></div>').tabs();
+ equals(el.tabs('option', 'selected'), -1, 'Initially empty, no selected tab');
+
+ el.tabs('add', '#test1', 'Test 1');
+ equals(el.tabs('option', 'selected'), 0, 'First tab added should be auto selected');
+
+ el.tabs('add', '#test2', 'Test 2');
+ equals(el.tabs('option', 'selected'), 0, 'Second tab added should not be auto selected');
+
+});
+
+test('remove', function() {
+ ok(false, "missing test - untested code is broken code.");
+});
+
+module("tabs (deprecated): methods");
+
+test('add', function() {
+ expect(4);
+
+ el = $('#tabs1').tabs();
+ el.tabs('add', '#new', 'New');
+
+ var added = $('li:last', el).simulate('mouseover');
+ ok(added.is('.ui-state-hover'), 'should add mouseover handler to added tab');
+ added.simulate('mouseout');
+ var other = $('li:first', el).simulate('mouseover');
+ ok(other.is('.ui-state-hover'), 'should not remove mouseover handler from existing tab');
+ other.simulate('mouseout');
+
+ equals($('a', added).attr('href'), '#new', 'should not expand href to full url of current page');
+
+ ok(false, "missing test - untested code is broken code.");
+});
+
+test('remove', function() {
+ expect(4);
+
+ el = $('#tabs1').tabs();
+
+ el.tabs('remove', 0);
+ equals(el.tabs('length'), 2, 'remove tab');
+ equals($('li a[href$="fragment-1"]', el).length, 0, 'remove associated list item');
+ equals($('#fragment-1').length, 0, 'remove associated panel');
+
+ // TODO delete tab -> focus tab to right
+ // TODO delete last tab -> focus tab to left
+
+ el.tabs('select', 1);
+ el.tabs('remove', 1);
+ equals(el.tabs('option', 'selected'), 0, 'update selected property');
+});
+
+test('#5069 - ui.tabs.add creates two tab panels when using a full URL', function() {
+ // http://dev.jqueryui.com/ticket/5069
+ expect(2);
+
+ el = $('#tabs2').tabs();
+ equals(el.children('div').length, el.find('> ul > li').length, 'After creation, number of panels should be equal to number of tabs');
+ el.tabs('add', '/ajax_html_echo', 'Test');
+ equals(el.children('div').length, el.find('> ul > li').length, 'After add, number of panels should be equal to number of tabs');
+
+});
+
}( jQuery ) );
diff --git a/tests/unit/tabs/tabs_events.js b/tests/unit/tabs/tabs_events.js
index 56c1360ee..b3f8653a2 100644
--- a/tests/unit/tabs/tabs_events.js
+++ b/tests/unit/tabs/tabs_events.js
@@ -69,23 +69,4 @@ test('show', function() {
});
-test('add', function() {
-
- // TODO move to methods, not at all event related...
-
- var el = $('<div id="tabs"><ul></ul></div>').tabs();
- equals(el.tabs('option', 'selected'), -1, 'Initially empty, no selected tab');
-
- el.tabs('add', '#test1', 'Test 1');
- equals(el.tabs('option', 'selected'), 0, 'First tab added should be auto selected');
-
- el.tabs('add', '#test2', 'Test 2');
- equals(el.tabs('option', 'selected'), 0, 'Second tab added should not be auto selected');
-
-});
-
-test('remove', function() {
- ok(false, "missing test - untested code is broken code.");
-});
-
})(jQuery);
diff --git a/tests/unit/tabs/tabs_methods.js b/tests/unit/tabs/tabs_methods.js
index 0209af697..ac0747df9 100644
--- a/tests/unit/tabs/tabs_methods.js
+++ b/tests/unit/tabs/tabs_methods.js
@@ -130,42 +130,6 @@ test('disable', function() {
same(el.tabs('option', 'disabled'), true, 'set to true');
});
-test('add', function() {
- expect(4);
-
- el = $('#tabs1').tabs();
- el.tabs('add', '#new', 'New');
-
- var added = $('li:last', el).simulate('mouseover');
- ok(added.is('.ui-state-hover'), 'should add mouseover handler to added tab');
- added.simulate('mouseout');
- var other = $('li:first', el).simulate('mouseover');
- ok(other.is('.ui-state-hover'), 'should not remove mouseover handler from existing tab');
- other.simulate('mouseout');
-
- equals($('a', added).attr('href'), '#new', 'should not expand href to full url of current page');
-
- ok(false, "missing test - untested code is broken code.");
-});
-
-test('remove', function() {
- expect(4);
-
- el = $('#tabs1').tabs();
-
- el.tabs('remove', 0);
- equals(el.tabs('length'), 2, 'remove tab');
- equals($('li a[href$="fragment-1"]', el).length, 0, 'remove associated list item');
- equals($('#fragment-1').length, 0, 'remove associated panel');
-
- // TODO delete tab -> focus tab to right
- // TODO delete last tab -> focus tab to left
-
- el.tabs('select', 1);
- el.tabs('remove', 1);
- equals(el.tabs('option', 'selected'), 0, 'update selected property');
-});
-
test('select', function() {
expect(6);
diff --git a/tests/unit/tabs/tabs_tickets.js b/tests/unit/tabs/tabs_tickets.js
index 4a09d59e4..5da799730 100644
--- a/tests/unit/tabs/tabs_tickets.js
+++ b/tests/unit/tabs/tabs_tickets.js
@@ -59,17 +59,6 @@ test('#4033 - IE expands hash to full url and misinterprets tab as ajax', functi
});
-test('#5069 - ui.tabs.add creates two tab panels when using a full URL', function() {
- // http://dev.jqueryui.com/ticket/5069
- expect(2);
-
- el = $('#tabs2').tabs();
- equals(el.children('div').length, el.find('> ul > li').length, 'After creation, number of panels should be equal to number of tabs');
- el.tabs('add', '/ajax_html_echo', 'Test');
- equals(el.children('div').length, el.find('> ul > li').length, 'After add, number of panels should be equal to number of tabs');
-
-});
-
test('#5893 - Sublist in the tab list are considered as tab', function() {
// http://dev.jqueryui.com/ticket/5893
expect(1);