github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

jquery / jquery-ui

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 794
    • 176
  • Source
  • Commits
  • Network (176)
  • Graphs
  • Tree: 7e03d4e

click here to add a description

click here to add a homepage

  • Switch Branches (8)
    • bind
    • devpreview
    • formcontrols
    • master
    • menu
    • panel
    • tooltip
    • widget-super
  • Switch Tags (19)
    • 1.9m2
    • 1.9m1
    • 1.8rc3
    • 1.8rc2
    • 1.8rc1
    • 1.8b1
    • 1.8a2
    • 1.8a1
    • 1.8.2
    • 1.8.1
    • 1.8
    • 1.7
    • 1.6rc6
    • 1.6rc5
    • 1.6rc3
    • 1.6rc2
    • 1.6
    • 1.5.2
    • 1.5.1
  • Comments
  • Contributors
Sending Request…

The official jQuery user interface library. — Read more

  Cancel

http://jqueryui.com/

  Cancel
  • HTTP
  • Git Read-Only

This URL has Read+Write access

Tabs: Updated tests.
scottgonzalez (author)
Fri Jul 16 17:20:28 -0700 2010
commit  7e03d4ea9deee68e9286
tree    0a1ade66ba1b1a4783f9
parent  eaddfedd668c3397ed3c
M tests/unit/tabs/tabs.html 3 •••
M tests/unit/tabs/tabs_methods.js 11 ••••
M ui/jquery.ui.tabs.js 10 ••••
Txt tests/unit/tabs/tabs.html
  • View file @ 7e03d4e
... ...
@@ -15,7 +15,8 @@
15 15
   <link rel="stylesheet" href="../../../external/qunit.css" type="text/css"/>
16 16
   <script type="text/javascript" src="../../../external/qunit.js"></script>
17 17
   <script type="text/javascript" src="../../jquery.simulate.js"></script>
18  
-
  18
+  <script type="text/javascript" src="../testsuite.js"></script>
  19
+  
19 20
   <script type="text/javascript" src="tabs_core.js"></script>
20 21
   <script type="text/javascript" src="tabs_defaults.js"></script>
21 22
   <script type="text/javascript" src="tabs_events.js"></script>
Txt tests/unit/tabs/tabs_methods.js
  • View file @ 7e03d4e
... ...
@@ -97,7 +97,7 @@ test('remove', function() {
97 97
 });
98 98
 
99 99
 test('select', function() {
100  
-  expect(9);
  100
+  expect(6);
101 101
 
102 102
   el = $('#tabs1').tabs();
103 103
 
... ...
@@ -115,20 +115,11 @@ test('select', function() {
115 115
   equals(el.tabs('option', 'selected'), -1, 'should collapse tab passing in -1');
116 116
 
117 117
   el.tabs('destroy');
118  
-  el.tabs({ collapsible: true });
119  
-  el.tabs('select', null);
120  
-  equals(el.tabs('option', 'selected'), -1, 'should collapse tab passing in null (deprecated)');
121  
-  el.tabs('select', null);
122  
-  equals(el.tabs('option', 'selected'), -1, 'should not select tab passing in null a second time (deprecated)');
123  
-
124  
-  el.tabs('destroy');
125 118
   el.tabs();
126 119
   el.tabs('select', 0);
127 120
   equals(el.tabs('option', 'selected'), 0, 'should not collapse tab if collapsible is not set to true');
128 121
   el.tabs('select', -1);
129 122
   equals(el.tabs('option', 'selected'), 0, 'should not collapse tab if collapsible is not set to true');
130  
-  el.tabs('select', null);
131  
-  equals(el.tabs('option', 'selected'), 0, 'should not collapse tab if collapsible is not set to true');
132 123
 
133 124
   el.tabs('select', '#fragment-2');
134 125
   equals(el.tabs('option', 'selected'), 1, 'should select tab by id');
Txt ui/jquery.ui.tabs.js
  • View file @ 7e03d4e
... ...
@@ -416,14 +416,10 @@ $.widget("ui.tabs", {
416 416
     _getIndex: function(index) {
417 417
     // meta-function to give users option to provide a href string instead of a numerical index.
418 418
     // also sanitizes numerical indexes to valid values.
419  
-    if (typeof(index) == 'string') {
  419
+    if (typeof index == 'string') {
420 420
       index = this.anchors.index(this.anchors.filter('[href$=' + index + ']'));
421  
-      index = (index ==-1?NaN:index);
422  
-    }else if (typeof(index) != 'number') {
423  
-      index = NaN;
424  
-    }else if (index > this.anchors.length) {
425  
-      index = this.anchors.length;
426 421
     }
  422
+    
427 423
     return index;
428 424
   },
429 425
 
... ...
@@ -579,7 +575,7 @@ $.widget("ui.tabs", {
579 575
 
580 576
   select: function(index) {
581 577
     index = this._getIndex(index);
582  
-    if (isNaN(index) && this.options.collapsible) {
  578
+    if (index == -1 && this.options.collapsible) {
583 579
       index = this.options.selected;
584 580
     }
585 581
     this.anchors.eq(index).trigger(this.options.event + '.tabs');

0 notes on commit 7e03d4e

Please log in to comment.
Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server
  • English
  • Català
  • Čeština
  • Deutsch
  • Español
  • Français
  • Hrvatski
  • Indonesia
  • Italiano
  • 日本語
  • Nederlands
  • Norsk
  • Polski
  • Português (BR)
  • Српски
  • Svenska