]> source.dussan.org Git - jquery-ui.git/commitdiff
Tabs: Test cleanup.
authorScott González <scott.gonzalez@gmail.com>
Mon, 4 Apr 2011 14:11:19 +0000 (10:11 -0400)
committerScott González <scott.gonzalez@gmail.com>
Mon, 4 Apr 2011 14:11:19 +0000 (10:11 -0400)
tests/unit/tabs/tabs.html
tests/unit/tabs/tabs_core.js
tests/unit/tabs/tabs_deprecated.html

index 02fbfe3bb0db036b4fb15a6284916dd52146213f..36e30517e81d6d93ca2aba762dadd9b1698485ea 100644 (file)
@@ -1,33 +1,32 @@
-<!DOCTYPE html>
+<!doctype html>
 <html lang="en">
 <head>
-       <meta charset="UTF-8" />
+       <meta charset="utf-8">
        <title>jQuery UI Tabs Test Suite</title>
 
-       <link type="text/css" href="../../../themes/base/jquery.ui.tabs.css" rel="stylesheet" />
+       <link rel="stylesheet" href="../../../themes/base/jquery.ui.tabs.css">
 
-       <script type="text/javascript" src="../../../jquery-1.5.1.js"></script>
+       <script src="../../../jquery-1.5.1.js"></script>
        <script>
-               $.uiBackCompat = false;
+       $.uiBackCompat = false;
        </script>
-       <script type="text/javascript" src="../../../external/jquery.cookie.js"></script>
-       <script type="text/javascript" src="../../../ui/jquery.ui.core.js"></script>
-       <script type="text/javascript" src="../../../ui/jquery.ui.widget.js"></script>
-       <script type="text/javascript" src="../../../ui/jquery.ui.tabs.js"></script>
+       <script src="../../../ui/jquery.ui.core.js"></script>
+       <script src="../../../ui/jquery.ui.widget.js"></script>
+       <script src="../../../ui/jquery.ui.tabs.js"></script>
 
-       <link rel="stylesheet" href="../../../external/qunit.css" type="text/css"/>
-       <script type="text/javascript" src="../../../external/qunit.js"></script>
-       <script type="text/javascript" src="../../jquery.simulate.js"></script>
-       <script type="text/javascript" src="../testsuite.js"></script>
-       
-       <script type="text/javascript" src="tabs_core.js"></script>
-       <script type="text/javascript" src="tabs_defaults.js"></script>
-       <script type="text/javascript" src="tabs_events.js"></script>
-       <script type="text/javascript" src="tabs_methods.js"></script>
-       <script type="text/javascript" src="tabs_options.js"></script>
-       <script type="text/javascript" src="tabs_tickets.js"></script>
-       
-       <script type="text/javascript">
+       <link rel="stylesheet" href="../../../external/qunit.css">
+       <script src="../../../external/qunit.js"></script>
+       <script src="../../jquery.simulate.js"></script>
+       <script src="../testsuite.js"></script>
+
+       <script src="tabs_defaults.js"></script>
+       <script src="tabs_core.js"></script>
+       <script src="tabs_events.js"></script>
+       <script src="tabs_methods.js"></script>
+       <script src="tabs_options.js"></script>
+       <script src="tabs_tickets.js"></script>
+
+       <script>
        // disable this stale testsuite for testswarm only
        var url = window.location.search;
        url = decodeURIComponent( url.slice( url.indexOf("swarmURL=") + 9 ) );
@@ -37,7 +36,7 @@
                test("tabs", function() { ok(true, "disabled tabs testsuite"); });
        }
        </script>
-       <script type="text/javascript" src="../swarminject.js"></script>
+       <script src="../swarminject.js"></script>
 </head>
 <body>
 
 <h2 id="qunit-banner"></h2>
 <div id="qunit-testrunner-toolbar"></div>
 <h2 id="qunit-userAgent"></h2>
-<ol id="qunit-tests">
-</ol>
-
+<ol id="qunit-tests"></ol>
 <div id="qunit-fixture">
 
-               <div id="tabs1">
-                       <ul>
-                               <li><a href="#fragment-1"><span>1</span></a></li>
-                               <li><a href="#fragment-2"><span>2</span></a></li>
-                               <li><a href="#fragment-3"><span>3</span></a></li>
-                       </ul>
-                       <div id="fragment-1"></div>
-                       <div id="fragment-2"></div>
-                       <div id="fragment-3"></div>
-               </div>
-               <div id="tabs2">
-                       <ul>
-                               <li><a href="#colon:test"><span>1</span></a></li>
-                               <li><a href="#inline-style"><span>2</span></a></li>
-                               <li><a href="data/test.html#test"><span>3</span></a></li>
-                               <li><a href="data/test.html" title="∫ßáö Սե"><span>4</span></a></li>
-                       </ul>
-                       <div id="colon:test"></div>
-                       <div style="height: 300px;" id="inline-style"></div>
-               </div>
-               <div id="tabs3">
-                       <div>
-                               <ul id="tabs3-list">
-                                       <li><a href="#tabs3-1">1</a></li>
-                               </ul>
-                       </div>
-               </div>
-               <div id="tabs4">
-                       <ul id="tabs4-list">
-                               <li><a href="#tabs4-1">1</a></li>
-                       </ul>
-                       <ol>
-                               <li><a href="#tabs4-1">1</a></li>
-                       </ol>
-               </div>
-               <div id="tabs4a">
-                       <ol id="tabs4a-list">
-                               <li><a href="#tabs4a-1">1</a></li>
-                       </ol>
+<div id="tabs1">
+       <ul>
+               <li><a href="#fragment-1"><span>1</span></a></li>
+               <li><a href="#fragment-2"><span>2</span></a></li>
+               <li><a href="#fragment-3"><span>3</span></a></li>
+       </ul>
+       <div id="fragment-1"></div>
+       <div id="fragment-2"></div>
+       <div id="fragment-3"></div>
+</div>
+
+<div id="tabs2">
+       <ul>
+               <li><a href="#colon:test"><span>1</span></a></li>
+               <li><a href="#inline-style"><span>2</span></a></li>
+               <li><a href="data/test.html#test"><span>3</span></a></li>
+               <li><a href="data/test.html" title="∫ßáö Սե"><span>4</span></a></li>
+       </ul>
+       <div id="colon:test"></div>
+       <div style="height: 300px;" id="inline-style"></div>
+</div>
+
+<div id="tabs3">
+       <div>
+               <ul id="tabs3-list">
+                       <li><a href="#tabs3-1">1</a></li>
+               </ul>
+       </div>
+</div>
+
+<div id="tabs4">
+       <ul id="tabs4-list">
+               <li><a href="#tabs4-1">1</a></li>
+       </ul>
+       <ol>
+               <li><a href="#tabs4-1">1</a></li>
+       </ol>
+</div>
+
+<div id="tabs4a">
+       <ol id="tabs4a-list">
+               <li><a href="#tabs4a-1">1</a></li>
+       </ol>
+       <ul>
+               <li><a href="#tabs4a-1">1</a></li>
+       </ul>
+</div>
+
+<div id="tabs5">
+       <div>
+               <ul id="tabs5-list"></ul>
+       </div>
+</div>
+
+<div id="tabs6">
+       <ul id="tabs6-list">
+               <li><a href="#tabs6-1">1</a>
                        <ul>
-                               <li><a href="#tabs4a-1">1</a></li>
+                               <li><a href="#item6-3">3</a></li>
+                               <li><a href="#item6-4">4</a></li>
                        </ul>
-               </div>
-               <div id="tabs5">
-                       <div>
-                               <ul id="tabs5-list"></ul>
-                       </div>
-               </div>
-               <div id="tabs6">
-                       <ul id="tabs6-list">
-                               <li><a href="#tabs6-1">1</a>
-                                       <ul>
-                                               <li><a href="#item6-3">3</a></li>
-                                               <li><a href="#item6-4">4</a></li>
-                                       </ul>
-                               </li>
-                               <li><a href="#tabs6-2">2</a></li>
-                       </ul>
-                       <div id="tabs6-1"></div>
-                       <div id="tabs6-2"></div>
-               </div>
-               <div id="tabs7">
-                       <ul id="tabs7-list">
-                               <li><a href="#tabs7-1">1</a></li>
-                               <li><a href="#tabs7-2">2</a></li>
-                       </ul>
-                       <div id="tabs7-2"></div>
-                       <div id="tabs7-1"></div>
-               </div>
-       </div>
+               </li>
+               <li><a href="#tabs6-2">2</a></li>
+       </ul>
+       <div id="tabs6-1"></div>
+       <div id="tabs6-2"></div>
+</div>
+
+<div id="tabs7">
+       <ul id="tabs7-list">
+               <li><a href="#tabs7-1">1</a></li>
+               <li><a href="#tabs7-2">2</a></li>
+       </ul>
+       <div id="tabs7-2"></div>
+       <div id="tabs7-1"></div>
+</div>
+
+</div>
 </body>
 </html>
index 7d9074819286aed01d9d1ad318c9589074445cd6..25e54c3ee18e53bf9b41f2c0e00dc28dc0d90f42 100644 (file)
@@ -1,28 +1,33 @@
-/*
- * tabs_core.js
- */
-var el;
+(function( $ ) {
 
-(function($) {
+module( "tabs: core" );
 
-module("tabs: core");
-
-test('navigation markup', function() {
-       el = $('#tabs3').tabs();
-       ok($('#tabs3-list').hasClass('ui-tabs-nav'), 'custom markup; allow list to be any descendant');
-       el.tabs('destroy');
-
-       el = $('#tabs4').tabs();
-       ok($('#tabs4-list').hasClass('ui-tabs-nav'), 'first list found becomes nav - ul');
-       el.tabs('destroy');
+test( "markup structure", function() {
+       expect( 3 );
+       var el = $( "#tabs1" ).tabs();
+       ok( el.hasClass( "ui-tabs" ), "main element is .ui-tabs" );
+       ok( el.find( "ul" ).hasClass( "ui-tabs-nav" ), "list item is .ui-tabs-nav" );
+       equal( el.find( ".ui-tabs-panel" ).length, 3,
+               ".ui-tabs-panel elements exist, correct number" );
+});
 
-       el = $('#tabs4a').tabs();
-       ok($('#tabs4a-list').hasClass('ui-tabs-nav'), 'first list found becomes nav - ol');
-       el.tabs('destroy');
+$.each({
+       "deep ul": "#tabs3",
+       "multiple lists, ul first": "#tabs4",
+       "multiple lists, ol first": "#tabs5",
+       "empty list": "#tabs6"
+}, function( type, selector ) {
+       test( "markup structure: " + type, function() {
+               expect( 2 );
+               var el = $( selector ).tabs();
+               ok( el.hasClass( "ui-tabs" ), "main element is .ui-tabs" );
+               ok( $( selector + "-list" ).hasClass( "ui-tabs-nav" ),
+                       "list item is .ui-tabs-nav" );
+       });
+});
 
-       el = $('#tabs5').tabs();
-       ok($('#tabs5-list').hasClass('ui-tabs-nav'), 'empty list can be used');
-       el.tabs('destroy');
+test( "accessibility", function() {
+       // TODO: add tests
 });
 
-})(jQuery);
+}( jQuery ) );
index 3b927675cf798fffcef949a3b29965a8161317b6..f886a9b7b2cbd4b522d025c6e233a587fcf8d4a1 100644 (file)
@@ -1,31 +1,31 @@
-<!DOCTYPE html>
+<!doctype html>
 <html lang="en">
 <head>
-       <meta charset="UTF-8" />
+       <meta charset="utf-8">
        <title>jQuery UI Tabs Test Suite</title>
 
-       <link type="text/css" href="../../../themes/base/jquery.ui.tabs.css" rel="stylesheet" />
+       <link rel="stylesheet" href="../../../themes/base/jquery.ui.tabs.css">
 
-       <script type="text/javascript" src="../../../jquery-1.5.1.js"></script>
-       <script type="text/javascript" src="../../../external/jquery.cookie.js"></script>
-       <script type="text/javascript" src="../../../ui/jquery.ui.core.js"></script>
-       <script type="text/javascript" src="../../../ui/jquery.ui.widget.js"></script>
-       <script type="text/javascript" src="../../../ui/jquery.ui.tabs.js"></script>
+       <script src="../../../jquery-1.5.1.js"></script>
+       <script src="../../../external/jquery.cookie.js"></script>
+       <script src="../../../ui/jquery.ui.core.js"></script>
+       <script src="../../../ui/jquery.ui.widget.js"></script>
+       <script src="../../../ui/jquery.ui.tabs.js"></script>
 
-       <link rel="stylesheet" href="../../../external/qunit.css" type="text/css"/>
-       <script type="text/javascript" src="../../../external/qunit.js"></script>
-       <script type="text/javascript" src="../../jquery.simulate.js"></script>
-       <script type="text/javascript" src="../testsuite.js"></script>
-       
-       <script type="text/javascript" src="tabs_core.js"></script>
-       <script type="text/javascript" src="tabs_defaults_deprecated.js"></script>
-       <script type="text/javascript" src="tabs_events.js"></script>
-       <script type="text/javascript" src="tabs_methods.js"></script>
-       <script type="text/javascript" src="tabs_options.js"></script>
-       <script type="text/javascript" src="tabs_tickets.js"></script>
-       <script type="text/javascript" src="tabs_deprecated.js"></script>
-       
-       <script type="text/javascript">
+       <link rel="stylesheet" href="../../../external/qunit.css">
+       <script src="../../../external/qunit.js"></script>
+       <script src="../../jquery.simulate.js"></script>
+       <script src="../testsuite.js"></script>
+
+       <script src="tabs_defaults_deprecated.js"></script>
+       <script src="tabs_core.js"></script>
+       <script src="tabs_events.js"></script>
+       <script src="tabs_methods.js"></script>
+       <script src="tabs_options.js"></script>
+       <script src="tabs_tickets.js"></script>
+       <script src="tabs_deprecated.js"></script>
+
+       <script>
        // disable this stale testsuite for testswarm only
        var url = window.location.search;
        url = decodeURIComponent( url.slice( url.indexOf("swarmURL=") + 9 ) );
                test("tabs", function() { ok(true, "disabled tabs testsuite"); });
        }
        </script>
-       <script type="text/javascript" src="../swarminject.js"></script>
+       <script src="../swarminject.js"></script>
 </head>
 <body>
 
-<h1 id="qunit-header">jQuery UI Tabs Test Suite (deprecated)</h1>
+<h1 id="qunit-header">jQuery UI Tabs Test Suite</h1>
 <h2 id="qunit-banner"></h2>
 <div id="qunit-testrunner-toolbar"></div>
 <h2 id="qunit-userAgent"></h2>
-<ol id="qunit-tests">
-</ol>
-
+<ol id="qunit-tests"></ol>
 <div id="qunit-fixture">
 
-               <div id="tabs1">
-                       <ul>
-                               <li><a href="#fragment-1"><span>1</span></a></li>
-                               <li><a href="#fragment-2"><span>2</span></a></li>
-                               <li><a href="#fragment-3"><span>3</span></a></li>
-                       </ul>
-                       <div id="fragment-1"></div>
-                       <div id="fragment-2"></div>
-                       <div id="fragment-3"></div>
-               </div>
-               <div id="tabs2">
-                       <ul>
-                               <li><a href="#colon:test"><span>1</span></a></li>
-                               <li><a href="#inline-style"><span>2</span></a></li>
-                               <li><a href="data/test.html#test"><span>3</span></a></li>
-                               <li><a href="data/test.html" title="∫ßáö Սե"><span>4</span></a></li>
-                       </ul>
-                       <div id="colon:test"></div>
-                       <div style="height: 300px;" id="inline-style"></div>
-               </div>
-               <div id="tabs3">
-                       <div>
-                               <ul id="tabs3-list">
-                                       <li><a href="#tabs3-1">1</a></li>
-                               </ul>
-                       </div>
-               </div>
-               <div id="tabs4">
-                       <ul id="tabs4-list">
-                               <li><a href="#tabs4-1">1</a></li>
-                       </ul>
-                       <ol>
-                               <li><a href="#tabs4-1">1</a></li>
-                       </ol>
-               </div>
-               <div id="tabs4a">
-                       <ol id="tabs4a-list">
-                               <li><a href="#tabs4a-1">1</a></li>
-                       </ol>
+<div id="tabs1">
+       <ul>
+               <li><a href="#fragment-1"><span>1</span></a></li>
+               <li><a href="#fragment-2"><span>2</span></a></li>
+               <li><a href="#fragment-3"><span>3</span></a></li>
+       </ul>
+       <div id="fragment-1"></div>
+       <div id="fragment-2"></div>
+       <div id="fragment-3"></div>
+</div>
+
+<div id="tabs2">
+       <ul>
+               <li><a href="#colon:test"><span>1</span></a></li>
+               <li><a href="#inline-style"><span>2</span></a></li>
+               <li><a href="data/test.html#test"><span>3</span></a></li>
+               <li><a href="data/test.html" title="∫ßáö Սե"><span>4</span></a></li>
+       </ul>
+       <div id="colon:test"></div>
+       <div style="height: 300px;" id="inline-style"></div>
+</div>
+
+<div id="tabs3">
+       <div>
+               <ul id="tabs3-list">
+                       <li><a href="#tabs3-1">1</a></li>
+               </ul>
+       </div>
+</div>
+
+<div id="tabs4">
+       <ul id="tabs4-list">
+               <li><a href="#tabs4-1">1</a></li>
+       </ul>
+       <ol>
+               <li><a href="#tabs4-1">1</a></li>
+       </ol>
+</div>
+
+<div id="tabs4a">
+       <ol id="tabs4a-list">
+               <li><a href="#tabs4a-1">1</a></li>
+       </ol>
+       <ul>
+               <li><a href="#tabs4a-1">1</a></li>
+       </ul>
+</div>
+
+<div id="tabs5">
+       <div>
+               <ul id="tabs5-list"></ul>
+       </div>
+</div>
+
+<div id="tabs6">
+       <ul id="tabs6-list">
+               <li><a href="#tabs6-1">1</a>
                        <ul>
-                               <li><a href="#tabs4a-1">1</a></li>
+                               <li><a href="#item6-3">3</a></li>
+                               <li><a href="#item6-4">4</a></li>
                        </ul>
-               </div>
-               <div id="tabs5">
-                       <div>
-                               <ul id="tabs5-list"></ul>
-                       </div>
-               </div>
-               <div id="tabs6">
-                       <ul id="tabs6-list">
-                               <li><a href="#tabs6-1">1</a>
-                                       <ul>
-                                               <li><a href="#item6-3">3</a></li>
-                                               <li><a href="#item6-4">4</a></li>
-                                       </ul>
-                               </li>
-                               <li><a href="#tabs6-2">2</a></li>
-                       </ul>
-                       <div id="tabs6-1"></div>
-                       <div id="tabs6-2"></div>
-               </div>
-               <div id="tabs7">
-                       <ul id="tabs7-list">
-                               <li><a href="#tabs7-1">1</a></li>
-                               <li><a href="#tabs7-2">2</a></li>
-                       </ul>
-                       <div id="tabs7-2"></div>
-                       <div id="tabs7-1"></div>
-               </div>
-       </div>
+               </li>
+               <li><a href="#tabs6-2">2</a></li>
+       </ul>
+       <div id="tabs6-1"></div>
+       <div id="tabs6-2"></div>
+</div>
+
+<div id="tabs7">
+       <ul id="tabs7-list">
+               <li><a href="#tabs7-1">1</a></li>
+               <li><a href="#tabs7-2">2</a></li>
+       </ul>
+       <div id="tabs7-2"></div>
+       <div id="tabs7-1"></div>
+</div>
+
+</div>
 </body>
 </html>