aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/tabs
diff options
context:
space:
mode:
authorDavid Petersen <public@petersendidit.com>2011-03-26 15:00:39 -0400
committerDavid Petersen <public@petersendidit.com>2011-03-26 21:00:34 -0400
commitaeaaf93ebb51ab6ff61a42d365edfd3872ae2ebd (patch)
treeab95271fe1860014ed4f8f82d8a207ed3e1d3759 /tests/unit/tabs
parent03ef2fb4525dc57cd397bfebf7b1f97e696ca3ff (diff)
downloadjquery-ui-aeaaf93ebb51ab6ff61a42d365edfd3872ae2ebd.tar.gz
jquery-ui-aeaaf93ebb51ab6ff61a42d365edfd3872ae2ebd.zip
Tabs: Add beforeload event; deprecate ajaxOptions and cache options. Fixes #7131 Tabs: Add beforeload event; deprecate ajaxOptions and cache options
Diffstat (limited to 'tests/unit/tabs')
-rw-r--r--tests/unit/tabs/tabs.html3
-rw-r--r--tests/unit/tabs/tabs_defaults.js3
-rw-r--r--tests/unit/tabs/tabs_defaults_deprecated.js28
-rw-r--r--tests/unit/tabs/tabs_deprecated.html122
-rw-r--r--tests/unit/tabs/tabs_deprecated.js13
-rw-r--r--tests/unit/tabs/tabs_events.js19
-rw-r--r--tests/unit/tabs/tabs_options.js8
7 files changed, 186 insertions, 10 deletions
diff --git a/tests/unit/tabs/tabs.html b/tests/unit/tabs/tabs.html
index 74855ca9a..02fbfe3bb 100644
--- a/tests/unit/tabs/tabs.html
+++ b/tests/unit/tabs/tabs.html
@@ -7,6 +7,9 @@
<link type="text/css" href="../../../themes/base/jquery.ui.tabs.css" rel="stylesheet" />
<script type="text/javascript" src="../../../jquery-1.5.1.js"></script>
+ <script>
+ $.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>
diff --git a/tests/unit/tabs/tabs_defaults.js b/tests/unit/tabs/tabs_defaults.js
index ef93c69ee..4f663fbf2 100644
--- a/tests/unit/tabs/tabs_defaults.js
+++ b/tests/unit/tabs/tabs_defaults.js
@@ -4,8 +4,7 @@
var tabs_defaults = {
add: null,
- ajaxOptions: null,
- cache: false,
+ beforeload: null,
collapsible: false,
cookie: null,
disable: null,
diff --git a/tests/unit/tabs/tabs_defaults_deprecated.js b/tests/unit/tabs/tabs_defaults_deprecated.js
new file mode 100644
index 000000000..73e9ffede
--- /dev/null
+++ b/tests/unit/tabs/tabs_defaults_deprecated.js
@@ -0,0 +1,28 @@
+/*
+ * tabs_defaults.js
+ */
+
+var tabs_defaults = {
+ add: null,
+ ajaxOptions: null,
+ beforeload: null,
+ cache: false,
+ collapsible: false,
+ cookie: null,
+ disable: null,
+ disabled: false,
+ enable: null,
+ event: "click",
+ fx: null,
+ idPrefix: "ui-tabs-",
+ load: null,
+ panelTemplate: "<div></div>",
+ remove: null,
+ select: null,
+ show: null,
+ spinner: "<em>Loading&#8230;</em>",
+ tabTemplate: "<li><a href='#{href}'><span>#{label}</span></a></li>"
+};
+
+// FAIL: falsy values break the cookie option
+commonWidgetTests( "tabs", { defaults: tabs_defaults } );
diff --git a/tests/unit/tabs/tabs_deprecated.html b/tests/unit/tabs/tabs_deprecated.html
new file mode 100644
index 000000000..3b927675c
--- /dev/null
+++ b/tests/unit/tabs/tabs_deprecated.html
@@ -0,0 +1,122 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8" />
+ <title>jQuery UI Tabs Test Suite</title>
+
+ <link type="text/css" href="../../../themes/base/jquery.ui.tabs.css" rel="stylesheet" />
+
+ <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>
+
+ <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">
+ // disable this stale testsuite for testswarm only
+ var url = window.location.search;
+ url = decodeURIComponent( url.slice( url.indexOf("swarmURL=") + 9 ) );
+ if ( url && url.indexOf("http") == 0 ) {
+ // reset config to kill previous tests; make sure testsuite.js is loaded afterwards to init the testswarm script
+ QUnit.init();
+ test("tabs", function() { ok(true, "disabled tabs testsuite"); });
+ }
+ </script>
+ <script type="text/javascript" src="../swarminject.js"></script>
+</head>
+<body>
+
+<h1 id="qunit-header">jQuery UI Tabs Test Suite (deprecated)</h1>
+<h2 id="qunit-banner"></h2>
+<div id="qunit-testrunner-toolbar"></div>
+<h2 id="qunit-userAgent"></h2>
+<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>
+ <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="#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>
+</body>
+</html>
diff --git a/tests/unit/tabs/tabs_deprecated.js b/tests/unit/tabs/tabs_deprecated.js
new file mode 100644
index 000000000..72034c083
--- /dev/null
+++ b/tests/unit/tabs/tabs_deprecated.js
@@ -0,0 +1,13 @@
+(function( $ ) {
+
+module("tabs (deprecated): cache and ajaxoptions");
+
+test('ajaxOptions', function() {
+ ok(false, "missing test - untested code is broken code.");
+});
+
+test('cache', function() {
+ ok(false, "missing test - untested code is broken code.");
+});
+
+}( jQuery ) );
diff --git a/tests/unit/tabs/tabs_events.js b/tests/unit/tabs/tabs_events.js
index 24fb62f9b..26ea76fb4 100644
--- a/tests/unit/tabs/tabs_events.js
+++ b/tests/unit/tabs/tabs_events.js
@@ -26,6 +26,25 @@ test('select', function() {
equals( evenObj.originalEvent.type, "click", "select triggered by click" );
});
+test('beforeload', function() {
+ expect( 5 );
+
+ el = $('#tabs2');
+
+ el.tabs({
+ selected: 2,
+ beforeload: function( event, ui ) {
+ ok( $.isFunction( ui.jqXHR.promise ), 'contain jqXHR object');
+ equals( ui.settings.url, "data/test.html", 'contain ajax settings url');
+ equals( ui.tab, el.find('a')[ 2 ], 'contain tab as DOM anchor element');
+ equals( ui.panel, el.find('div')[ 2 ], 'contain panel as DOM div element');
+ equals( ui.index, 2, 'contain index');
+ event.preventDefault();
+ }
+ });
+
+});
+
test('load', function() {
ok(false, "missing test - untested code is broken code.");
});
diff --git a/tests/unit/tabs/tabs_options.js b/tests/unit/tabs/tabs_options.js
index 1c621ac28..cf50bd970 100644
--- a/tests/unit/tabs/tabs_options.js
+++ b/tests/unit/tabs/tabs_options.js
@@ -5,14 +5,6 @@
module("tabs: options");
-test('ajaxOptions', function() {
- ok(false, "missing test - untested code is broken code.");
-});
-
-test('cache', function() {
- ok(false, "missing test - untested code is broken code.");
-});
-
test('collapsible', function() {
expect(4);