aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/tabs/tabs_deprecated.js
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/tabs/tabs_deprecated.js')
-rw-r--r--tests/unit/tabs/tabs_deprecated.js49
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/unit/tabs/tabs_deprecated.js b/tests/unit/tabs/tabs_deprecated.js
index 7e4816793..8b6b50d7e 100644
--- a/tests/unit/tabs/tabs_deprecated.js
+++ b/tests/unit/tabs/tabs_deprecated.js
@@ -65,6 +65,55 @@ test('spinner', function() {
});
});
+test('selected', function() {
+ expect(11);
+
+ el = $('#tabs1').tabs();
+ equals(el.tabs('option', 'selected'), 0, 'should be 0 by default');
+
+ el.tabs('destroy');
+ //set a hash in the url
+ location.hash = '#fragment-2';
+ //selection of tab with divs ordered differently than list
+ el = $('#tabs1').tabs();
+ equals(el.tabs('option', 'selected'), 1, 'second tab should be selected');
+
+ el.tabs('destroy');
+ //set a hash in the url
+ location.hash = '#tabs7-2';
+ //selection of tab with divs ordered differently than list
+ el = $('#tabs7').tabs();
+ equals(el.tabs('option', 'selected'), 1, 'second tab should be selected');
+
+ el.tabs('destroy');
+ el = $('#tabs1').tabs({ selected: -1 });
+ equals(el.tabs('option', 'selected'), -1, 'should be -1 for all tabs unselected');
+ equals( $('li.ui-tabs-selected', el).length, 0, 'no tab should be selected' );
+ equals( $('div.ui-tabs-hide', '#tabs1').length, 3, 'all panels should be hidden' );
+
+ el.tabs('destroy');
+ el.tabs({ selected: null });
+ equals(el.tabs('option', 'selected'), -1, 'should be -1 for all tabs unselected with value null (deprecated)');
+
+ el.tabs('destroy');
+ el.tabs({ selected: 1 });
+ equals(el.tabs('option', 'selected'), 1, 'should be specified tab');
+
+ el.tabs('destroy');
+ el.tabs({ selected: 99 });
+ equals(el.tabs('option', 'selected'), 0, 'selected should default to zero if given value is out of index');
+
+ el.tabs('destroy');
+ el.tabs({ collapsible: true });
+ el.tabs('option', 'selected', 0);
+ equals(el.tabs('option', 'selected'), 0, 'should not collapse tab if value is same as selected');
+
+ el.tabs('destroy');
+ el = $('#tabs1').tabs();
+ el.tabs('select', 1);
+ equals(el.tabs('option', 'selected'), 1, 'should select tab');
+});
+
module("tabs (deprecated): events");
test('enable', function() {