aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/unit/tabs/tabs.html8
-rw-r--r--tests/unit/tabs/tabs_core.js9
-rw-r--r--tests/unit/tabs/tabs_deprecated.html8
-rw-r--r--ui/jquery.ui.tabs.js2
4 files changed, 26 insertions, 1 deletions
diff --git a/tests/unit/tabs/tabs.html b/tests/unit/tabs/tabs.html
index 3a55f3b79..e6c954727 100644
--- a/tests/unit/tabs/tabs.html
+++ b/tests/unit/tabs/tabs.html
@@ -145,6 +145,14 @@
</div>
</div>
+<div id="tabs9">
+ <ul>
+ <li>not a tab</li>
+ <li><a href="#tabs9-1">tab</a></li>
+ </ul>
+ <div id="tabs9-1"></div>
+</div>
+
</div>
</body>
</html>
diff --git a/tests/unit/tabs/tabs_core.js b/tests/unit/tabs/tabs_core.js
index 53dd50a98..5dbe1d6b1 100644
--- a/tests/unit/tabs/tabs_core.js
+++ b/tests/unit/tabs/tabs_core.js
@@ -44,6 +44,15 @@ test( "disconnected from DOM", function() {
equal( element.find( ".ui-tabs-panel" ).length, 3, "should initialize panels" );
});
+test( "non-tab list items", function() {
+ expect( 2 );
+
+ var element = $( "#tabs9" ).tabs();
+ equal( element.tabs( "option", "active" ), 0, "defaults to first tab" );
+ equal( element.find( ".ui-tabs-nav li.ui-state-active" ).index(), 1,
+ "first actual tab is active" );
+});
+
test( "aria-controls", function() {
expect( 7 );
var element = $( "#tabs1" ).tabs(),
diff --git a/tests/unit/tabs/tabs_deprecated.html b/tests/unit/tabs/tabs_deprecated.html
index bb4088350..9d3ecef3a 100644
--- a/tests/unit/tabs/tabs_deprecated.html
+++ b/tests/unit/tabs/tabs_deprecated.html
@@ -144,6 +144,14 @@
</div>
</div>
+<div id="tabs9">
+ <ul>
+ <li>not a tab</li>
+ <li><a href="#tabs9-1">tab</a></li>
+ </ul>
+ <div id="tabs9-1"></div>
+</div>
+
</div>
</body>
</html>
diff --git a/ui/jquery.ui.tabs.js b/ui/jquery.ui.tabs.js
index 7631366d6..60377ad13 100644
--- a/ui/jquery.ui.tabs.js
+++ b/ui/jquery.ui.tabs.js
@@ -102,7 +102,7 @@ $.widget( "ui.tabs", {
// handle numbers: negative, out of range
if ( active !== false ) {
- active = this.tabs.eq( active ).index();
+ active = this.tabs.index( this.tabs.eq( active ) );
if ( active === -1 ) {
active = options.collapsible ? false : 0;
}