summaryrefslogtreecommitdiff
path: root/src/main/webapp/jquery-ui-1.9pre/tests/unit/tabs
diff options
context:
space:
mode:
authorLeif Johansson <leifj@sunet.se>2011-11-25 21:18:19 +0100
committerLeif Johansson <leifj@sunet.se>2011-11-25 21:18:19 +0100
commit3909e6d89e01e4cd8777377c63037896bb95aa2f (patch)
tree59679df287c2bee55087fb5afb8d42e7f93a44fb /src/main/webapp/jquery-ui-1.9pre/tests/unit/tabs
parente5f94e9be5017f627c1ccd8c6306c5cc2e200432 (diff)
new jq layout
Diffstat (limited to 'src/main/webapp/jquery-ui-1.9pre/tests/unit/tabs')
-rw-r--r--src/main/webapp/jquery-ui-1.9pre/tests/unit/tabs/all.html30
-rw-r--r--src/main/webapp/jquery-ui-1.9pre/tests/unit/tabs/data/test.html1
-rw-r--r--src/main/webapp/jquery-ui-1.9pre/tests/unit/tabs/tabs.html181
-rw-r--r--src/main/webapp/jquery-ui-1.9pre/tests/unit/tabs/tabs_core.js94
-rw-r--r--src/main/webapp/jquery-ui-1.9pre/tests/unit/tabs/tabs_defaults.js16
-rw-r--r--src/main/webapp/jquery-ui-1.9pre/tests/unit/tabs/tabs_defaults_deprecated.js29
-rw-r--r--src/main/webapp/jquery-ui-1.9pre/tests/unit/tabs/tabs_deprecated.html180
-rw-r--r--src/main/webapp/jquery-ui-1.9pre/tests/unit/tabs/tabs_deprecated.js576
-rw-r--r--src/main/webapp/jquery-ui-1.9pre/tests/unit/tabs/tabs_events.js277
-rw-r--r--src/main/webapp/jquery-ui-1.9pre/tests/unit/tabs/tabs_methods.js237
-rw-r--r--src/main/webapp/jquery-ui-1.9pre/tests/unit/tabs/tabs_options.js213
11 files changed, 1834 insertions, 0 deletions
diff --git a/src/main/webapp/jquery-ui-1.9pre/tests/unit/tabs/all.html b/src/main/webapp/jquery-ui-1.9pre/tests/unit/tabs/all.html
new file mode 100644
index 0000000..363edc0
--- /dev/null
+++ b/src/main/webapp/jquery-ui-1.9pre/tests/unit/tabs/all.html
@@ -0,0 +1,30 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <title>jQuery UI Tabs Test Suite</title>
+
+ <script src="../../../jquery-1.7.1.js"></script>
+
+ <link rel="stylesheet" href="../../../external/qunit.css">
+ <link rel="stylesheet" href="../subsuiteRunner.css">
+ <script src="../../../external/qunit.js"></script>
+ <script src="../subsuiteRunner.js"></script>
+ <script src="../subsuite.js"></script>
+
+ <script>
+ testAllVersions( "tabs" );
+ </script>
+</head>
+<body>
+
+<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>
+<div id="qunit-fixture">
+
+</div>
+</body>
+</html>
diff --git a/src/main/webapp/jquery-ui-1.9pre/tests/unit/tabs/data/test.html b/src/main/webapp/jquery-ui-1.9pre/tests/unit/tabs/data/test.html
new file mode 100644
index 0000000..cd59e64
--- /dev/null
+++ b/src/main/webapp/jquery-ui-1.9pre/tests/unit/tabs/data/test.html
@@ -0,0 +1 @@
+<p>&#8230;content loaded via Ajax.</p> \ No newline at end of file
diff --git a/src/main/webapp/jquery-ui-1.9pre/tests/unit/tabs/tabs.html b/src/main/webapp/jquery-ui-1.9pre/tests/unit/tabs/tabs.html
new file mode 100644
index 0000000..f2a672b
--- /dev/null
+++ b/src/main/webapp/jquery-ui-1.9pre/tests/unit/tabs/tabs.html
@@ -0,0 +1,181 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <title>jQuery UI Tabs Test Suite</title>
+
+ <script src="../../jquery.js"></script>
+ <script>
+ $.uiBackCompat = false;
+ </script>
+ <script src="../../resource_loader.js"></script>
+ <script>
+ loadResources({
+ css: [ "ui.core", "ui.tabs" ],
+ js: [
+ "ui/jquery.ui.core.js",
+ "ui/jquery.ui.widget.js",
+ "ui/jquery.ui.tabs.js"
+ ]
+ });
+ </script>
+
+ <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>
+ function tabs_state( tabs ) {
+ var expected = $.makeArray( arguments ).slice( 1 );
+ var actual = tabs.find( ".ui-tabs-nav li" ).map(function() {
+ var tab = $( this ),
+ panel = $( $.ui.tabs.prototype._sanitizeSelector(
+ "#" + tab.find( "a" ).attr( "aria-controls" ) ) ),
+ tabIsActive = tab.hasClass( "ui-state-active" ),
+ panelIsActive = panel.css( "display" ) !== "none";
+
+ if ( tabIsActive && panelIsActive ) {
+ return 1;
+ }
+ if ( !tabIsActive && !panelIsActive ) {
+ return 0;
+ }
+ return -1; // mixed state - invalid
+ }).get();
+ same( actual, expected );
+ }
+
+ function tabs_disabled( tabs, state ) {
+ var expected = $.map( new Array( tabs.find ( ".ui-tabs-nav li" ).length ), function( _, index ) {
+ if ( typeof state === "boolean" ) {
+ return state ? 1 : 0;
+ } else {
+ return $.inArray( index, state ) !== -1 ? 1 : 0;
+ }
+ });
+
+ var internalState = tabs.tabs( "option", "disabled" );
+ if ( internalState === false ) {
+ internalState = [];
+ }
+ if ( internalState === true ) {
+ internalState = $.map( new Array( tabs.find( ".ui-tabs-nav li" ).length ), function( _, index ) {
+ return index;
+ });
+ }
+
+ var actual = tabs.find( ".ui-tabs-nav li" ).map(function( index ) {
+ var tab = $( this ),
+ tabIsDisabled = tab.hasClass( "ui-state-disabled" );
+
+ if ( tabIsDisabled && $.inArray( index, internalState ) !== -1 ) {
+ return 1;
+ }
+ if ( !tabIsDisabled && $.inArray( index, internalState ) === -1 ) {
+ return 0;
+ }
+ return -1; // mixed state - invalid
+ }).get();
+ same( tabs.tabs( "option", "disabled" ), state );
+ same( actual, expected );
+ }
+ </script>
+ <script src="../swarminject.js"></script>
+</head>
+<body>
+
+<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>
+<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" aria-controls="custom-id"><span>4</span></a></li>
+ <li><a href="data/test.html" title="∫ßáö Սե"><span>5</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/src/main/webapp/jquery-ui-1.9pre/tests/unit/tabs/tabs_core.js b/src/main/webapp/jquery-ui-1.9pre/tests/unit/tabs/tabs_core.js
new file mode 100644
index 0000000..e7c1ee5
--- /dev/null
+++ b/src/main/webapp/jquery-ui-1.9pre/tests/unit/tabs/tabs_core.js
@@ -0,0 +1,94 @@
+(function( $ ) {
+
+module( "tabs: core" );
+
+test( "markup structure", function() {
+ expect( 3 );
+ var element = $( "#tabs1" ).tabs();
+ ok( element.hasClass( "ui-tabs" ), "main element is .ui-tabs" );
+ ok( element.find( "ul" ).hasClass( "ui-tabs-nav" ), "list item is .ui-tabs-nav" );
+ equal( element.find( ".ui-tabs-panel" ).length, 3,
+ ".ui-tabs-panel elements exist, correct number" );
+});
+
+$.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 element = $( selector ).tabs();
+ ok( element.hasClass( "ui-tabs" ), "main element is .ui-tabs" );
+ ok( $( selector + "-list" ).hasClass( "ui-tabs-nav" ),
+ "list item is .ui-tabs-nav" );
+ });
+});
+
+// #5893 - Sublist in the tab list are considered as tab
+test( "nested list", function() {
+ expect( 1 );
+
+ var element = $( "#tabs6" ).tabs();
+ equals( element.data( "tabs" ).anchors.length, 2, "should contain 2 tab" );
+});
+
+test( "disconnected from DOM", function() {
+ expect( 2 );
+
+ var element = $( "#tabs1" ).remove().tabs();
+ equals( element.find( ".ui-tabs-nav" ).length, 1, "should initialize nav" );
+ equals( element.find( ".ui-tabs-panel" ).length, 3, "should initialize panels" );
+});
+
+test( "aria-controls", function() {
+ expect( 7 );
+ var element = $( "#tabs1" ).tabs(),
+ tabs = element.find( ".ui-tabs-nav a" );
+ tabs.each(function() {
+ var tab = $( this );
+ equal( tab.prop( "hash" ).substring( 1 ), tab.attr( "aria-controls" ) );
+ });
+
+ element = $( "#tabs2" ).tabs();
+ tabs = element.find( ".ui-tabs-nav a" );
+ equal( tabs.eq( 0 ).attr( "aria-controls" ), "colon:test" );
+ equal( tabs.eq( 1 ).attr( "aria-controls" ), "inline-style" );
+ ok( /^ui-tabs-\d+$/.test( tabs.eq( 2 ).attr( "aria-controls" ) ), "generated id" );
+ equal( tabs.eq( 3 ).attr( "aria-controls" ), "custom-id" );
+});
+
+test( "accessibility", function() {
+ // TODO: add tests
+});
+
+test( "#3627 - Ajax tab with url containing a fragment identifier fails to load", function() {
+ expect( 1 );
+
+ var element = $( "#tabs2" ).tabs({
+ active: 2,
+ beforeLoad: function( event, ui ) {
+ event.preventDefault();
+ ok( /test.html$/.test( ui.ajaxSettings.url ), "should ignore fragment identifier" );
+ }
+ });
+});
+
+test( "#4033 - IE expands hash to full url and misinterprets tab as ajax", function() {
+ expect( 2 );
+
+ var element = $( "<div><ul><li><a href='#tab'>Tab</a></li></ul><div id='tab'></div></div>" );
+ element.appendTo( "#main" );
+ element.tabs({
+ beforeLoad: function( event, ui ) {
+ event.preventDefault();
+ ok( false, 'should not be an ajax tab');
+ }
+ });
+
+ equals( element.find( ".ui-tabs-nav a" ).attr( "aria-controls" ), "tab", "aria-contorls attribute is correct" );
+ tabs_state( element, 1 );
+});
+
+}( jQuery ) );
diff --git a/src/main/webapp/jquery-ui-1.9pre/tests/unit/tabs/tabs_defaults.js b/src/main/webapp/jquery-ui-1.9pre/tests/unit/tabs/tabs_defaults.js
new file mode 100644
index 0000000..52b6f8a
--- /dev/null
+++ b/src/main/webapp/jquery-ui-1.9pre/tests/unit/tabs/tabs_defaults.js
@@ -0,0 +1,16 @@
+commonWidgetTests( "tabs", {
+ defaults: {
+ active: null,
+ collapsible: false,
+ disabled: false,
+ event: "click",
+ fx: null,
+
+ // callbacks
+ activate: null,
+ beforeActivate: null,
+ beforeLoad: null,
+ create: null,
+ load: null
+ }
+});
diff --git a/src/main/webapp/jquery-ui-1.9pre/tests/unit/tabs/tabs_defaults_deprecated.js b/src/main/webapp/jquery-ui-1.9pre/tests/unit/tabs/tabs_defaults_deprecated.js
new file mode 100644
index 0000000..1a56297
--- /dev/null
+++ b/src/main/webapp/jquery-ui-1.9pre/tests/unit/tabs/tabs_defaults_deprecated.js
@@ -0,0 +1,29 @@
+commonWidgetTests( "tabs", {
+ defaults: {
+ active: null,
+ ajaxOptions: null,
+ cache: false,
+ collapsible: false,
+ cookie: null,
+ disabled: false,
+ event: "click",
+ fx: null,
+ idPrefix: "ui-tabs-",
+ panelTemplate: "<div></div>",
+ spinner: "<em>Loading&#8230;</em>",
+ tabTemplate: "<li><a href='#{href}'><span>#{label}</span></a></li>",
+
+ // callbacks
+ activate: null,
+ add: null,
+ beforeActivate: null,
+ beforeLoad: null,
+ create: null,
+ disable: null,
+ enable: null,
+ load: null,
+ remove: null,
+ select: null,
+ show: null
+ }
+});
diff --git a/src/main/webapp/jquery-ui-1.9pre/tests/unit/tabs/tabs_deprecated.html b/src/main/webapp/jquery-ui-1.9pre/tests/unit/tabs/tabs_deprecated.html
new file mode 100644
index 0000000..92d9be8
--- /dev/null
+++ b/src/main/webapp/jquery-ui-1.9pre/tests/unit/tabs/tabs_deprecated.html
@@ -0,0 +1,180 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <title>jQuery UI Tabs Test Suite</title>
+
+ <script src="../../jquery.js"></script>
+ <script src="../../../external/jquery.cookie.js"></script>
+ <script src="../../resource_loader.js"></script>
+ <script>
+ loadResources({
+ css: [ "ui.core", "ui.tabs" ],
+ js: [
+ "ui/jquery.ui.core.js",
+ "ui/jquery.ui.widget.js",
+ "ui/jquery.ui.tabs.js"
+ ]
+ });
+ </script>
+
+ <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_deprecated.js"></script>
+
+ <script>
+ function tabs_state( tabs ) {
+ var expected = $.makeArray( arguments ).slice( 1 );
+ var actual = tabs.find( ".ui-tabs-nav li" ).map(function() {
+ var tab = $( this ),
+ panel = $( $.ui.tabs.prototype._sanitizeSelector(
+ "#" + tab.find( "a" ).attr( "aria-controls" ) ) ),
+ tabIsActive = tab.hasClass( "ui-state-active" ),
+ panelIsActive = panel.css( "display" ) !== "none";
+
+ if ( tabIsActive && panelIsActive ) {
+ return 1;
+ }
+ if ( !tabIsActive && !panelIsActive ) {
+ return 0;
+ }
+ return -1; // mixed state - invalid
+ }).get();
+ same( actual, expected );
+ }
+
+ function tabs_disabled( tabs, state ) {
+ var expected = $.map( new Array( tabs.find ( ".ui-tabs-nav li" ).length ), function( _, index ) {
+ if ( typeof state === "boolean" ) {
+ return state ? 1 : 0;
+ } else {
+ return $.inArray( index, state ) !== -1 ? 1 : 0;
+ }
+ });
+
+ var internalState = tabs.tabs( "option", "disabled" );
+ if ( internalState === false ) {
+ internalState = [];
+ }
+ if ( internalState === true ) {
+ internalState = $.map( new Array( tabs.find( ".ui-tabs-nav li" ).length ), function( _, index ) {
+ return index;
+ });
+ }
+
+ var actual = tabs.find( ".ui-tabs-nav li" ).map(function( index ) {
+ var tab = $( this ),
+ tabIsDisabled = tab.hasClass( "ui-state-disabled" );
+
+ if ( tabIsDisabled && $.inArray( index, internalState ) !== -1 ) {
+ return 1;
+ }
+ if ( !tabIsDisabled && $.inArray( index, internalState ) === -1 ) {
+ return 0;
+ }
+ return -1; // mixed state - invalid
+ }).get();
+ same( tabs.tabs( "option", "disabled" ), state );
+ same( actual, expected );
+ }
+ </script>
+ <script src="../swarminject.js"></script>
+</head>
+<body>
+
+<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>
+<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" aria-controls="custom-id"><span>4</span></a></li>
+ <li><a href="data/test.html" title="∫ßáö Սե"><span>5</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/src/main/webapp/jquery-ui-1.9pre/tests/unit/tabs/tabs_deprecated.js b/src/main/webapp/jquery-ui-1.9pre/tests/unit/tabs/tabs_deprecated.js
new file mode 100644
index 0000000..1323c77
--- /dev/null
+++ b/src/main/webapp/jquery-ui-1.9pre/tests/unit/tabs/tabs_deprecated.js
@@ -0,0 +1,576 @@
+(function( $ ) {
+
+module( "tabs (deprecated): core" );
+
+test( "panel ids", function() {
+ expect( 2 );
+
+ var element = $( "#tabs2" ).tabs();
+
+ element.one( "tabsbeforeload", function( event, ui ) {
+ equal( ui.panel.attr( "id" ), "∫ßáö_Սե", "from title attribute" );
+ event.preventDefault();
+ });
+ element.tabs( "option", "active", 4 );
+
+ element.one( "tabsbeforeload", function( event, ui ) {
+ ok( /^ui-tabs-\d+$/.test( ui.panel.attr( "id" ) ), "generated id" );
+ event.preventDefault();
+ });
+ element.tabs( "option", "active", 2 );
+});
+
+module( "tabs (deprecated): options" );
+
+asyncTest( "ajaxOptions", function() {
+ expect( 1 );
+
+ var element = $( "#tabs2" ).tabs({
+ ajaxOptions: {
+ converters: {
+ "text html": function() {
+ return "test";
+ }
+ }
+ }
+ });
+ element.one( "tabsload", function( event, ui ) {
+ equals( $( ui.panel ).html(), "test" );
+ start();
+ });
+ element.tabs( "option", "active", 2 );
+});
+
+asyncTest( "cache", function() {
+ expect( 5 );
+
+ var element = $( "#tabs2" ).tabs({
+ cache: true
+ });
+ element.one( "tabsshow", function( event, ui ) {
+ tabs_state( element, 0, 0, 1, 0, 0 );
+ });
+ element.one( "tabsload", function( event, ui ) {
+ ok( true, "tabsload" );
+
+ setTimeout(function() {
+ element.tabs( "option", "active", 0 );
+ tabs_state( element, 1, 0, 0, 0, 0 );
+
+ element.one( "tabsshow", function( event, ui ) {
+ tabs_state( element, 0, 0, 1, 0, 0 );
+ });
+ element.one( "tabsload", function( event, ui ) {
+ ok( false, "should be cached" );
+ });
+ element.tabs( "option", "active", 2 );
+ start();
+ }, 1 );
+ });
+ element.tabs( "option", "active", 2 );
+ tabs_state( element, 0, 0, 1, 0, 0 );
+});
+
+test( "idPrefix", function() {
+ expect( 1 );
+
+ $( "#tabs2" )
+ .one( "tabsbeforeload", function( event, ui ) {
+ ok( /^testing-\d+$/.test( ui.panel.attr( "id" ) ), "generated id" );
+ event.preventDefault();
+ })
+ .tabs({
+ idPrefix: "testing-",
+ active: 2
+ });
+});
+
+test( "tabTemplate + panelTemplate", function() {
+ // defaults are tested in the add method test
+ expect( 11 );
+
+ var element = $( "#tabs2" ).tabs({
+ tabTemplate: "<li class='customTab'><a href='http://example.com/#{href}'>#{label}</a></li>",
+ panelTemplate: "<div class='customPanel'></div>"
+ });
+ element.one( "tabsadd", function( event, ui ) {
+ var anchor = $( ui.tab );
+ equal( ui.index, 5, "ui.index" );
+ equal( anchor.text(), "New", "ui.tab" );
+ equal( anchor.attr( "href" ), "http://example.com/#new", "tab href" );
+ ok( anchor.parent().hasClass( "customTab" ), "tab custom class" );
+ equal( ui.panel.id, "new", "ui.panel" );
+ ok( $( ui.panel ).hasClass( "customPanel" ), "panel custom class" );
+ });
+ element.tabs( "add", "#new", "New" );
+ var tab = element.find( ".ui-tabs-nav li" ).last(),
+ anchor = tab.find( "a" );
+ equals( tab.text(), "New", "label" );
+ ok( tab.hasClass( "customTab" ), "tab custom class" );
+ equals( anchor.attr( "href" ), "http://example.com/#new", "href" );
+ equals( anchor.attr( "aria-controls" ), "new", "aria-controls" );
+ ok( element.find( "#new" ).hasClass( "customPanel" ), "panel custom class" );
+});
+
+test( "cookie", function() {
+ expect( 6 );
+
+ var element = $( "#tabs1" ),
+ cookieName = "tabs_test",
+ cookieObj = { name: cookieName };
+ $.cookie( cookieName, null );
+ function cookie() {
+ return parseInt( $.cookie( cookieName ), 10 );
+ }
+
+ element.tabs({ cookie: cookieObj });
+ equals( cookie(), 0, "initial cookie value" );
+
+ element.tabs( "destroy" );
+ element.tabs({ active: 1, cookie: cookieObj });
+ equals( cookie(), 1, "initial cookie value, from active property" );
+
+ element.tabs( "option", "active", 2 );
+ equals( cookie(), 2, "cookie value updated after activating" );
+
+ element.tabs( "destroy" );
+ $.cookie( cookieName, 1 );
+ element.tabs({ cookie: cookieObj });
+ equals( cookie(), 1, "initial cookie value, from existing cookie" );
+
+ element.tabs( "destroy" );
+ element.tabs({ cookie: cookieObj, collapsible: true });
+ element.tabs( "option", "active", false );
+ equals( cookie(), -1, "cookie value for all tabs unselected" );
+
+ element.tabs( "destroy" );
+ ok( $.cookie( cookieName ) === null, "erase cookie after destroy" );
+});
+
+asyncTest( "spinner", function() {
+ expect( 2 );
+
+ var element = $( "#tabs2" ).tabs();
+
+ element.one( "tabsbeforeload", function( event, ui ) {
+ equals( element.find( ".ui-tabs-nav li:eq(2) em" ).length, 1, "beforeload" );
+ });
+ element.one( "tabsload", function( event, ui ) {
+ // wait until after the load finishes before checking for the spinner to be removed
+ setTimeout(function() {
+ equals( element.find( ".ui-tabs-nav li:eq(2) em" ).length, 0, "load" );
+ start();
+ }, 1 );
+ });
+ element.tabs( "option", "active", 2 );
+});
+
+test( "selected", function() {
+ expect( 19 );
+
+ var element = $( "#tabs1" ).tabs();
+ equals( element.tabs( "option", "selected" ), 0, "should be 0 by default" );
+ tabs_state( element, 1, 0, 0 );
+ element.tabs( "destroy" );
+
+ location.hash = "#fragment-3";
+ element = $( "#tabs1" ).tabs();
+ equals( element.tabs( "option", "selected" ), 2, "should be 2 based on URL" );
+ tabs_state( element, 0, 0, 1 );
+ element.tabs( "destroy" );
+
+ el = $('#tabs1').tabs({
+ selected: -1,
+ collapsible: true
+ });
+ tabs_state( element, 0, 0, 0 );
+ equal( element.find( ".ui-tabs-nav .ui-state-active" ).size(), 0, "no tabs selected" );
+ strictEqual( element.tabs( "option", "selected" ), -1 );
+
+ element.tabs( "option", "collapsible", false );
+ tabs_state( element, 1, 0, 0 );
+ equal( element.tabs( "option", "selected" ), 0 );
+ element.tabs( "destroy" );
+
+ element.tabs({
+ selected: -1
+ });
+ tabs_state( element, 1, 0, 0 );
+ strictEqual( element.tabs( "option", "selected" ), 0 );
+ element.tabs( "destroy" );
+
+ element.tabs({ selected: 2 });
+ equals( element.tabs( "option", "selected" ), 2 );
+ tabs_state( element, 0, 0, 1 );
+
+ element.tabs( "option", "selected", 0 );
+ equals( element.tabs( "option", "selected" ), 0 );
+ tabs_state( element, 1, 0, 0 );
+
+ element.find( ".ui-tabs-nav a" ).eq( 1 ).click();
+ equals( element.tabs( "option", "selected" ), 1 );
+ tabs_state( element, 0, 1, 0 );
+
+ element.tabs( "option", "selected", 10 );
+ equals( element.tabs( "option", "selected" ), 1 );
+ tabs_state( element, 0, 1, 0 );
+
+ location.hash = "#";
+});
+
+module( "tabs (deprecated): events" );
+
+asyncTest( "load", function() {
+ expect( 15 );
+
+ var tab, panelId, panel,
+ element = $( "#tabs2" );
+
+ // init
+ element.one( "tabsload", function( event, ui ) {
+ tab = element.find( ".ui-tabs-nav a" ).eq( 2 );
+ panelId = tab.attr( "aria-controls" );
+ panel = $( "#" + panelId );
+
+ ok( !( "originalEvent" in event ), "originalEvent" );
+ strictEqual( ui.tab, tab[ 0 ], "tab" );
+ strictEqual( ui.panel, panel[ 0 ], "panel" );
+ equals( $( ui.panel ).find( "p" ).length, 1, "panel html" );
+ tabs_state( element, 0, 0, 1, 0, 0 );
+ tabsload1();
+ });
+ element.tabs({ active: 2 });
+
+ function tabsload1() {
+ // .option()
+ element.one( "tabsload", function( event, ui ) {
+ tab = element.find( ".ui-tabs-nav a" ).eq( 3 );
+ panelId = tab.attr( "aria-controls" );
+ panel = $( "#" + panelId );
+
+ ok( !( "originalEvent" in event ), "originalEvent" );
+ strictEqual( ui.tab, tab[ 0 ], "tab" );
+ strictEqual( ui.panel, panel[ 0 ], "panel" );
+ equals( $( ui.panel ).find( "p" ).length, 1, "panel html" );
+ tabs_state( element, 0, 0, 0, 1, 0 );
+ tabsload2();
+ });
+ element.tabs( "option", "active", 3 );
+ }
+
+ function tabsload2() {
+ // click, change panel content
+ element.one( "tabsload", function( event, ui ) {
+ tab = element.find( ".ui-tabs-nav a" ).eq( 4 );
+ panelId = tab.attr( "aria-controls" );
+ panel = $( "#" + panelId );
+
+ equals( event.originalEvent.type, "click", "originalEvent" );
+ strictEqual( ui.tab, tab[ 0 ], "tab" );
+ strictEqual( ui.panel, panel[ 0 ], "panel" );
+ equals( $( ui.panel ).find( "p" ).length, 1, "panel html" );
+ tabs_state( element, 0, 0, 0, 0, 1 );
+ start();
+ });
+ element.find( ".ui-tabs-nav a" ).eq( 4 ).click();
+ }
+});
+
+test( "enable", function() {
+ expect( 3 );
+
+ var element = $( "#tabs1" ).tabs({
+ disabled: [ 0, 1 ],
+ enable: function ( event, ui ) {
+ equals( ui.tab, element.find( ".ui-tabs-nav a" )[ 1 ], "ui.tab" );
+ equals( ui.panel, element.find( ".ui-tabs-panel" )[ 1 ], "ui.panel" );
+ equals( ui.index, 1, "ui.index" );
+ }
+ });
+ element.tabs( "enable", 1 );
+ // shouldn't trigger event
+ element.tabs( "enable", 2 );
+});
+
+test( "disable", function() {
+ expect( 3 );
+
+ var element = $( "#tabs1" ).tabs({
+ disable: function ( event, ui ) {
+ equals( ui.tab, element.find( ".ui-tabs-nav a" )[ 1 ], "ui.tab" );
+ equals( ui.panel, element.find( ".ui-tabs-panel" )[ 1 ], "ui.panel" );
+ equals( ui.index, 1, "ui.index" );
+ }
+ });
+ element.tabs( "disable", 1 );
+ // shouldn't trigger event
+ element.tabs( "disable", 1 );
+});
+
+
+test( "show", function() {
+ expect( 13 );
+
+ var element = $( "#tabs1" ).tabs({
+ active: false,
+ collapsible: true
+ }),
+ tabs = element.find( ".ui-tabs-nav a" ),
+ panels = element.find( ".ui-tabs-panel" );
+
+ // from collapsed
+ element.one( "tabsshow", function( event, ui ) {
+ ok( !( "originalEvent" in event ), "originalEvent" );
+ strictEqual( ui.tab, tabs[ 0 ], "ui.tab" );
+ strictEqual( ui.panel, panels[ 0 ], "ui.panel" );
+ equal( ui.index, 0, "ui.index" );
+ tabs_state( element, 1, 0, 0 );
+ });
+ element.tabs( "option", "active", 0 );
+ tabs_state( element, 1, 0, 0 );
+
+ // switching tabs
+ element.one( "tabsshow", function( event, ui ) {
+ equals( event.originalEvent.type, "click", "originalEvent" );
+ strictEqual( ui.tab, tabs[ 1 ], "ui.tab" );
+ strictEqual( ui.panel, panels[ 1 ], "ui.panel" );
+ equal( ui.index, 1, "ui.index" );
+ tabs_state( element, 0, 1, 0 );
+ });
+ tabs.eq( 1 ).click();
+ tabs_state( element, 0, 1, 0 );
+
+ // collapsing
+ element.one( "tabsshow", function( event, ui ) {
+ ok( false, "collapsing" );
+ });
+ element.tabs( "option", "active", false );
+ tabs_state( element, 0, 0, 0 );
+});
+
+test( "select", function() {
+ expect( 13 );
+
+ var element = $( "#tabs1" ).tabs({
+ active: false,
+ collapsible: true
+ }),
+ tabs = element.find( ".ui-tabs-nav a" ),
+ panels = element.find( ".ui-tabs-panel" );
+
+ // from collapsed
+ element.one( "tabsselect", function( event, ui ) {
+ ok( !( "originalEvent" in event ), "originalEvent" );
+ strictEqual( ui.tab, tabs[ 0 ], "ui.tab" );
+ strictEqual( ui.panel, panels[ 0 ], "ui.panel" );
+ equal( ui.index, 0, "ui.index" );
+ tabs_state( element, 0, 0, 0 );
+ });
+ element.tabs( "option", "active", 0 );
+ tabs_state( element, 1, 0, 0 );
+
+ // switching tabs
+ element.one( "tabsselect", function( event, ui ) {
+ equals( event.originalEvent.type, "click", "originalEvent" );
+ strictEqual( ui.tab, tabs[ 1 ], "ui.tab" );
+ strictEqual( ui.panel, panels[ 1 ], "ui.panel" );
+ equal( ui.index, 1, "ui.index" );
+ tabs_state( element, 1, 0, 0 );
+ });
+ tabs.eq( 1 ).click();
+ tabs_state( element, 0, 1, 0 );
+
+ // collapsing
+ element.one( "tabsselect", function( event, ui ) {
+ ok( false, "collapsing" );
+ });
+ element.tabs( "option", "active", false );
+ tabs_state( element, 0, 0, 0 );
+});
+
+module( "tabs (deprecated): methods" );
+
+test( "add", function() {
+ expect( 27 );
+
+ var element = $( "#tabs1" ).tabs();
+ tabs_state( element, 1, 0, 0 );
+
+ // add without index
+ element.one( "tabsadd", function( event, ui ) {
+ equal( ui.index, 3, "ui.index" );
+ equal( $( ui.tab ).text(), "New", "ui.tab" );
+ equal( ui.panel.id, "new", "ui.panel" );
+ });
+ element.tabs( "add", "#new", "New" );
+ tabs_state( element, 1, 0, 0, 0 );
+ var tab = element.find( ".ui-tabs-nav li" ).last(),
+ anchor = tab.find( "a" );
+ equals( tab.text(), "New", "label" );
+ equals( anchor.attr( "href" ), "#new", "href" );
+ equals( anchor.attr( "aria-controls" ), "new", "aria-controls" );
+ ok( !tab.hasClass( "ui-state-hover" ), "not hovered" );
+ anchor.simulate( "mouseover" );
+ ok( tab.hasClass( "ui-state-hover" ), "hovered" );
+ anchor.simulate( "click" );
+ tabs_state( element, 0, 0, 0, 1 );
+
+ // add remote tab with index
+ element.one( "tabsadd", function( event, ui ) {
+ equal( ui.index, 1, "ui.index" );
+ equal( $( ui.tab ).text(), "New Remote", "ui.tab" );
+ equal( ui.panel.id, $( ui.tab ).attr( "aria-controls" ), "ui.panel" );
+ });
+ element.tabs( "add", "data/test.html", "New Remote", 1 );
+ tabs_state( element, 0, 0, 0, 0, 1 );
+ tab = element.find( ".ui-tabs-nav li" ).eq( 1 );
+ anchor = tab.find( "a" );
+ equals( tab.text(), "New Remote", "label" );
+ equals( anchor.attr( "href" ), "data/test.html", "href" );
+ ok( /^ui-tabs-\d+$/.test( anchor.attr( "aria-controls" ) ), "aria controls" );
+ ok( !tab.hasClass( "ui-state-hover" ), "not hovered" );
+ anchor.simulate( "mouseover" );
+ ok( tab.hasClass( "ui-state-hover" ), "hovered" );
+ anchor.simulate( "click" );
+ tabs_state( element, 0, 1, 0, 0, 0 );
+
+ // add to empty tab set
+ element = $( "<div><ul></ul></div>" ).tabs();
+ equals( element.tabs( "option", "active" ), false, "active: false on init" );
+ element.one( "tabsadd", function( event, ui ) {
+ equal( ui.index, 0, "ui.index" );
+ equal( $( ui.tab ).text(), "First", "ui.tab" );
+ equal( ui.panel.id, "first", "ui.panel" );
+ });
+ element.tabs( "add", "#first", "First" );
+ tabs_state( element, 1 );
+ equals( element.tabs( "option", "active" ), 0, "active: 0 after add" );
+});
+
+test( "#5069 - ui.tabs.add creates two tab panels when using a full URL", function() {
+ expect( 2 );
+
+ var element = $( "#tabs2" ).tabs();
+ equals( element.children( "div" ).length, element.find( ".ui-tabs-nav li" ).length );
+ element.tabs( "add", "/new", "New" );
+ equals( element.children( "div" ).length, element.find( ".ui-tabs-nav li" ).length );
+});
+
+test( "remove", function() {
+ expect( 17 );
+
+ var element = $( "#tabs1" ).tabs({ active: 1 });
+ tabs_state( element, 0, 1, 0 );
+
+ element.one( "tabsremove", function( event, ui ) {
+ equal( ui.index, -1, "ui.index" );
+ equal( $( ui.tab ).text(), "2", "ui.tab" );
+ equal( ui.panel.id, "fragment-2", "ui.panel" );
+ });
+ element.tabs( "remove", 1 );
+ tabs_state( element, 0, 1 );
+ equals( element.tabs( "option", "active" ), 1 );
+ equals( element.find( ".ui-tabs-nav li a[href$='fragment-2']" ).length, 0,
+ "remove correct list item" );
+ equals( element.find( "#fragment-2" ).length, 0, "remove correct panel" );
+
+ element.one( "tabsremove", function( event, ui ) {
+ equal( ui.index, -1, "ui.index" );
+ equal( $( ui.tab ).text(), "3", "ui.tab" );
+ equal( ui.panel.id, "fragment-3", "ui.panel" );
+ });
+ element.tabs( "remove", 1 );
+ tabs_state( element, 1 );
+ equals( element.tabs( "option", "active"), 0 );
+
+ element.one( "tabsremove", function( event, ui ) {
+ equal( ui.index, -1, "ui.index" );
+ equal( $( ui.tab ).text(), "1", "ui.tab" );
+ equal( ui.panel.id, "fragment-1", "ui.panel" );
+ });
+ element.tabs( "remove", 0 );
+ equals( element.tabs( "option", "active" ), false );
+});
+
+test( "select", function() {
+ expect( 23 );
+
+ var element = $( "#tabs1" ).tabs();
+ tabs_state( element, 1, 0, 0 );
+ element.tabs( "select", 1 );
+ tabs_state( element, 0, 1, 0 );
+ equals( element.tabs( "option", "active" ), 1, "active" );
+ equals( element.tabs( "option", "selected" ), 1, "selected" );
+ element.tabs( "destroy" );
+
+ element.tabs({ collapsible: true });
+ tabs_state( element, 1, 0, 0 );
+ element.tabs( "select", 0 );
+ tabs_state( element, 0, 0, 0 );
+ equals( element.tabs( "option", "active" ), false, "active" );
+ equals( element.tabs( "option", "selected" ), -1, "selected" );
+ element.tabs( "destroy" );
+
+ element.tabs({ collapsible: true });
+ element.tabs( "select", -1 );
+ tabs_state( element, 0, 0, 0 );
+ equals( element.tabs( "option", "active" ), false, "active" );
+ equals( element.tabs( "option", "selected" ), -1, "selected" );
+ element.tabs( "destroy" );
+
+ element.tabs();
+ tabs_state( element, 1, 0, 0 );
+ equals( element.tabs( "option", "active" ), 0, "active" );
+ equals( element.tabs( "option", "selected" ), 0, "selected" );
+ element.tabs( "select", 0 );
+ tabs_state( element, 1, 0, 0 );
+ equals( element.tabs( "option", "active" ), 0, "active" );
+ equals( element.tabs( "option", "selected" ), 0, "selected" );
+ element.tabs( "select", -1 );
+ tabs_state( element, 1, 0, 0 );
+ equals( element.tabs( "option", "active" ), 0, "active" );
+ equals( element.tabs( "option", "selected" ), 0, "selected" );
+
+ element.tabs( "select", "#fragment-2" );
+ tabs_state( element, 0, 1, 0 );
+ equals( element.tabs( "option", "active" ), 1, "active" );
+ equals( element.tabs( "option", "selected" ), 1, "selected" );
+});
+
+test( "length", function() {
+ expect( 2 );
+
+ equals( $( "#tabs1" ).tabs().tabs( "length" ), 3, "basic tabs" );
+ equals( $( "#tabs2" ).tabs().tabs( "length" ), 5, "ajax tabs with missing panels" );
+});
+
+test( "url", function() {
+ expect( 2 );
+
+ var element = $( "#tabs2" ).tabs(),
+ tab = element.find( "a" ).eq( 3 );
+
+ element.tabs( "url", 3, "data/test2.html" );
+ equals( tab.attr( "href" ), "data/test2.html", "href was updated" );
+ element.one( "tabsbeforeload", function( event, ui ) {
+ equals( ui.ajaxSettings.url, "data/test2.html", "ajaxSettings.url" );
+ event.preventDefault();
+ });
+ element.tabs( "option", "active", 3 );
+});
+
+asyncTest( "abort", function() {
+ expect( 1 );
+
+ var element = $( "#tabs2" ).tabs();
+ element.one( "tabsbeforeload", function( event, ui ) {
+ ui.jqXHR.error(function( jqXHR, status ) {
+ equals( status, "abort", "aborted" );
+ start();
+ });
+ });
+ element.tabs( "option", "active", 2 );
+ element.tabs( "abort" );
+});
+
+}( jQuery ) );
diff --git a/src/main/webapp/jquery-ui-1.9pre/tests/unit/tabs/tabs_events.js b/src/main/webapp/jquery-ui-1.9pre/tests/unit/tabs/tabs_events.js
new file mode 100644
index 0000000..f5cde18
--- /dev/null
+++ b/src/main/webapp/jquery-ui-1.9pre/tests/unit/tabs/tabs_events.js
@@ -0,0 +1,277 @@
+(function( $ ) {
+
+module( "tabs: events" );
+
+test( "beforeActivate", function() {
+ expect( 38 );
+
+ var element = $( "#tabs1" ).tabs({
+ active: false,
+ collapsible: true
+ }),
+ tabs = element.find( ".ui-tabs-nav a" ),
+ panels = element.find( ".ui-tabs-panel" );
+
+ // from collapsed
+ element.one( "tabsbeforeactivate", function( event, ui ) {
+ ok( !( "originalEvent" in event ), "originalEvent" );
+ equals( ui.oldTab.size(), 0, "oldTab size" );
+ equals( ui.oldPanel.size(), 0, "oldPanel size" );
+ equals( ui.newTab.size(), 1, "newTab size" );
+ strictEqual( ui.newTab[ 0 ], tabs[ 0 ], "newTab" );
+ equals( ui.newPanel.size(), 1, "newPanel size" );
+ strictEqual( ui.newPanel[ 0 ], panels[ 0 ], "newPanel" );
+ tabs_state( element, 0, 0, 0 );
+ });
+ element.tabs( "option", "active", 0 );
+ tabs_state( element, 1, 0, 0 );
+
+ // switching tabs
+ element.one( "tabsbeforeactivate", function( event, ui ) {
+ equals( event.originalEvent.type, "click", "originalEvent" );
+ equals( ui.oldTab.size(), 1, "oldTab size" );
+ strictEqual( ui.oldTab[ 0 ], tabs[ 0 ], "oldTab" );
+ equals( ui.oldPanel.size(), 1, "oldPanel size" );
+ strictEqual( ui.oldPanel[ 0 ], panels[ 0 ], "oldPanel" );
+ equals( ui.newTab.size(), 1, "newTab size" );
+ strictEqual( ui.newTab[ 0 ], tabs[ 1 ], "newTab" );
+ equals( ui.newPanel.size(), 1, "newPanel size" );
+ strictEqual( ui.newPanel[ 0 ], panels[ 1 ], "newPanel" );
+ tabs_state( element, 1, 0, 0 );
+ });
+ tabs.eq( 1 ).click();
+ tabs_state( element, 0, 1, 0 );
+
+ // collapsing
+ element.one( "tabsbeforeactivate", function( event, ui ) {
+ ok( !( "originalEvent" in event ), "originalEvent" );
+ equals( ui.oldTab.size(), 1, "oldTab size" );
+ strictEqual( ui.oldTab[ 0 ], tabs[ 1 ], "oldTab" );
+ equals( ui.oldPanel.size(), 1, "oldPanel size" );
+ strictEqual( ui.oldPanel[ 0 ], panels[ 1 ], "oldPanel" );
+ equals( ui.newTab.size(), 0, "newTab size" );
+ equals( ui.newPanel.size(), 0, "newPanel size" );
+ tabs_state( element, 0, 1, 0 );
+ });
+ element.tabs( "option", "active", false );
+ tabs_state( element, 0, 0, 0 );
+
+ // prevent activation
+ element.one( "tabsbeforeactivate", function( event, ui ) {
+ ok( !( "originalEvent" in event ), "originalEvent" );
+ equals( ui.oldTab.size(), 0, "oldTab size" );
+ equals( ui.oldPanel.size(), 0, "oldTab" );
+ equals( ui.newTab.size(), 1, "newTab size" );
+ strictEqual( ui.newTab[ 0 ], tabs[ 1 ], "newTab" );
+ equals( ui.newPanel.size(), 1, "newPanel size" );
+ strictEqual( ui.newPanel[ 0 ], panels[ 1 ], "newPanel" );
+ event.preventDefault();
+ tabs_state( element, 0, 0, 0 );
+ });
+ element.tabs( "option", "active", 1 );
+ tabs_state( element, 0, 0, 0 );
+});
+
+test( "activate", function() {
+ expect( 30 );
+
+ var element = $( "#tabs1" ).tabs({
+ active: false,
+ collapsible: true
+ }),
+ tabs = element.find( ".ui-tabs-nav a" ),
+ panels = element.find( ".ui-tabs-panel" );
+
+ // from collapsed
+ element.one( "tabsactivate", function( event, ui ) {
+ ok( !( "originalEvent" in event ), "originalEvent" );
+ equals( ui.oldTab.size(), 0, "oldTab size" );
+ equals( ui.oldPanel.size(), 0, "oldPanel size" );
+ equals( ui.newTab.size(), 1, "newTab size" );
+ strictEqual( ui.newTab[ 0 ], tabs[ 0 ], "newTab" );
+ equals( ui.newPanel.size(), 1, "newPanel size" );
+ strictEqual( ui.newPanel[ 0 ], panels[ 0 ], "newPanel" );
+ tabs_state( element, 1, 0, 0 );
+ });
+ element.tabs( "option", "active", 0 );
+ tabs_state( element, 1, 0, 0 );
+
+ // switching tabs
+ element.one( "tabsactivate", function( event, ui ) {
+ equals( event.originalEvent.type, "click", "originalEvent" );
+ equals( ui.oldTab.size(), 1, "oldTab size" );
+ strictEqual( ui.oldTab[ 0 ], tabs[ 0 ], "oldTab" );
+ equals( ui.oldPanel.size(), 1, "oldPanel size" );
+ strictEqual( ui.oldPanel[ 0 ], panels[ 0 ], "oldPanel" );
+ equals( ui.newTab.size(), 1, "newTab size" );
+ strictEqual( ui.newTab[ 0 ], tabs[ 1 ], "newTab" );
+ equals( ui.newPanel.size(), 1, "newPanel size" );
+ strictEqual( ui.newPanel[ 0 ], panels[ 1 ], "newPanel" );
+ tabs_state( element, 0, 1, 0 );
+ });
+ tabs.eq( 1 ).click();
+ tabs_state( element, 0, 1, 0 );
+
+ // collapsing
+ element.one( "tabsactivate", function( event, ui ) {
+ ok( !( "originalEvent" in event ), "originalEvent" );
+ equals( ui.oldTab.size(), 1, "oldTab size" );
+ strictEqual( ui.oldTab[ 0 ], tabs[ 1 ], "oldTab" );
+ equals( ui.oldPanel.size(), 1, "oldPanel size" );
+ strictEqual( ui.oldPanel[ 0 ], panels[ 1 ], "oldPanel" );
+ equals( ui.newTab.size(), 0, "newTab size" );
+ equals( ui.newPanel.size(), 0, "newPanel size" );
+ tabs_state( element, 0, 0, 0 );
+ });
+ element.tabs( "option", "active", false );
+ tabs_state( element, 0, 0, 0 );
+
+ // prevent activation
+ element.one( "tabsbeforeactivate", function( event ) {
+ ok( true, "tabsbeforeactivate" );
+ event.preventDefault();
+ });
+ element.one( "tabsactivate", function() {
+ ok( false, "tabsactivate" );
+ });
+ element.tabs( "option", "active", 1 );
+});
+
+test( "beforeLoad", function() {
+ expect( 32 );
+
+ var tab, panelId, panel,
+ element = $( "#tabs2" );
+
+ // init
+ element.one( "tabsbeforeload", function( event, ui ) {
+ tab = element.find( ".ui-tabs-nav a" ).eq( 2 );
+ panelId = tab.attr( "aria-controls" );
+ panel = $( "#" + panelId );
+
+ ok( !( "originalEvent" in event ), "originalEvent" );
+ ok( "abort" in ui.jqXHR, "jqXHR" );
+ ok( ui.ajaxSettings.url, "data/test.html", "ajaxSettings.url" );
+ equals( ui.tab.size(), 1, "tab size" );
+ strictEqual( ui.tab[ 0 ], tab[ 0 ], "tab" );
+ equals( ui.panel.size(), 1, "panel size" );
+ strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" );
+ equals( ui.panel.html(), "", "panel html" );
+ event.preventDefault();
+ tabs_state( element, 0, 0, 1, 0, 0 );
+ });
+ element.tabs({ active: 2 });
+ tabs_state( element, 0, 0, 1, 0, 0 );
+ equals( panel.html(), "", "panel html after" );
+ element.tabs( "destroy" );
+
+ // .option()
+ element.one( "tabsbeforeload", function( event, ui ) {
+ tab = element.find( ".ui-tabs-nav a" ).eq( 2 );
+ panelId = tab.attr( "aria-controls" );
+ panel = $( "#" + panelId );
+
+ ok( !( "originalEvent" in event ), "originalEvent" );
+ ok( "abort" in ui.jqXHR, "jqXHR" );
+ ok( ui.ajaxSettings.url, "data/test.html", "ajaxSettings.url" );
+ equals( ui.tab.size(), 1, "tab size" );
+ strictEqual( ui.tab[ 0 ], tab[ 0 ], "tab" );
+ equals( ui.panel.size(), 1, "panel size" );
+ strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" );
+ equals( ui.panel.html(), "", "panel html" );
+ event.preventDefault();
+ tabs_state( element, 1, 0, 0, 0, 0 );
+ });
+ element.tabs();
+ element.tabs( "option", "active", 2 );
+ tabs_state( element, 0, 0, 1, 0, 0 );
+ equals( panel.html(), "", "panel html after" );
+
+ // click, change panel content
+ element.one( "tabsbeforeload", function( event, ui ) {
+ tab = element.find( ".ui-tabs-nav a" ).eq( 3 );
+ panelId = tab.attr( "aria-controls" );
+ panel = $( "#" + panelId );
+
+ equals( event.originalEvent.type, "click", "originalEvent" );
+ ok( "abort" in ui.jqXHR, "jqXHR" );
+ ok( ui.ajaxSettings.url, "data/test.html", "ajaxSettings.url" );
+ equals( ui.tab.size(), 1, "tab size" );
+ strictEqual( ui.tab[ 0 ], tab[ 0 ], "tab" );
+ equals( ui.panel.size(), 1, "panel size" );
+ strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" );
+ ui.panel.html( "<p>testing</p>" );
+ event.preventDefault();
+ tabs_state( element, 0, 0, 1, 0, 0 );
+ });
+ element.find( ".ui-tabs-nav a" ).eq( 3 ).click();
+ tabs_state( element, 0, 0, 0, 1, 0 );
+ // .toLowerCase() is needed to convert <P> to <p> in old IEs
+ equals( panel.html().toLowerCase(), "<p>testing</p>", "panel html after" );
+});
+
+if ( $.uiBackCompat === false ) {
+ asyncTest( "load", function() {
+ expect( 21 );
+
+ var tab, panelId, panel,
+ element = $( "#tabs2" );
+
+ // init
+ element.one( "tabsload", function( event, ui ) {
+ tab = element.find( ".ui-tabs-nav a" ).eq( 2 );
+ panelId = tab.attr( "aria-controls" );
+ panel = $( "#" + panelId );
+
+ ok( !( "originalEvent" in event ), "originalEvent" );
+ equals( ui.tab.size(), 1, "tab size" );
+ strictEqual( ui.tab[ 0 ], tab[ 0 ], "tab" );
+ equals( ui.panel.size(), 1, "panel size" );
+ strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" );
+ equals( ui.panel.find( "p" ).length, 1, "panel html" );
+ tabs_state( element, 0, 0, 1, 0, 0 );
+ tabsload1();
+ });
+ element.tabs({ active: 2 });
+
+ function tabsload1() {
+ // .option()
+ element.one( "tabsload", function( event, ui ) {
+ tab = element.find( ".ui-tabs-nav a" ).eq( 3 );
+ panelId = tab.attr( "aria-controls" );
+ panel = $( "#" + panelId );
+
+ ok( !( "originalEvent" in event ), "originalEvent" );
+ equals( ui.tab.size(), 1, "tab size" );
+ strictEqual( ui.tab[ 0 ], tab[ 0 ], "tab" );
+ equals( ui.panel.size(), 1, "panel size" );
+ strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" );
+ equals( ui.panel.find( "p" ).length, 1, "panel html" );
+ tabs_state( element, 0, 0, 0, 1, 0 );
+ tabsload2();
+ });
+ element.tabs( "option", "active", 3 );
+ }
+
+ function tabsload2() {
+ // click, change panel content
+ element.one( "tabsload", function( event, ui ) {
+ tab = element.find( ".ui-tabs-nav a" ).eq( 4 );
+ panelId = tab.attr( "aria-controls" );
+ panel = $( "#" + panelId );
+
+ equals( event.originalEvent.type, "click", "originalEvent" );
+ equals( ui.tab.size(), 1, "tab size" );
+ strictEqual( ui.tab[ 0 ], tab[ 0 ], "tab" );
+ equals( ui.panel.size(), 1, "panel size" );
+ strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" );
+ equals( ui.panel.find( "p" ).length, 1, "panel html" );
+ tabs_state( element, 0, 0, 0, 0, 1 );
+ start();
+ });
+ element.find( ".ui-tabs-nav a" ).eq( 4 ).click();
+ }
+ });
+}
+
+}( jQuery ) );
diff --git a/src/main/webapp/jquery-ui-1.9pre/tests/unit/tabs/tabs_methods.js b/src/main/webapp/jquery-ui-1.9pre/tests/unit/tabs/tabs_methods.js
new file mode 100644
index 0000000..b62f7bb
--- /dev/null
+++ b/src/main/webapp/jquery-ui-1.9pre/tests/unit/tabs/tabs_methods.js
@@ -0,0 +1,237 @@
+(function( $ ) {
+
+module( "tabs: methods" );
+
+test( "destroy", function() {
+ domEqual( "#tabs1", function() {
+ $( "#tabs1" ).tabs().tabs( "destroy" );
+ });
+});
+
+test( "enable", function() {
+ expect( 8 );
+
+ var element = $( "#tabs1" ).tabs({ disabled: true });
+ tabs_disabled( element, true );
+ element.tabs( "enable" );
+ tabs_disabled( element, false );
+ element.tabs( "destroy" );
+
+ element.tabs({ disabled: [ 0, 1 ] });
+ tabs_disabled( element, [ 0, 1 ] );
+ element.tabs( "enable" );
+ tabs_disabled( element, false );
+});
+
+test( "enable( index )", function() {
+ expect( 10 );
+
+ var element = $( "#tabs1" ).tabs({ disabled: true });
+ tabs_disabled( element, true );
+ // fully disabled -> partially disabled
+ element.tabs( "enable", 1 );
+ tabs_disabled( element, [ 0, 2 ] );
+ // partially disabled -> partially disabled
+ element.tabs( "enable", 2 );
+ tabs_disabled( element, [ 0 ] );
+ // already enabled tab, no change
+ element.tabs( "enable", 2 );
+ tabs_disabled( element, [ 0 ] );
+ // partially disabled -> fully enabled
+ element.tabs( "enable", 0 );
+ tabs_disabled( element, false );
+});
+
+test( "disable", function() {
+ expect( 8 );
+
+ var element = $( "#tabs1" ).tabs({ disabled: false });
+ tabs_disabled( element, false );
+ element.tabs( "disable" );
+ tabs_disabled( element, true );
+ element.tabs( "destroy" );
+
+ element.tabs({ disabled: [ 0, 1 ] });
+ tabs_disabled( element, [ 0, 1 ] );
+ element.tabs( "disable" );
+ tabs_disabled( element, true );
+});
+
+test( "disable( index )", function() {
+ expect( 10 );
+
+ var element = $( "#tabs1" ).tabs({ disabled: false });
+ tabs_disabled( element, false );
+ // fully enabled -> partially disabled
+ element.tabs( "disable", 1 );
+ tabs_disabled( element, [ 1 ] );
+ // partially disabled -> partially disabled
+ element.tabs( "disable", 2 );
+ tabs_disabled( element, [ 1, 2 ] );
+ // already disabled tab, no change
+ element.tabs( "disable", 2 );
+ tabs_disabled( element, [ 1, 2 ] );
+ // partially disabled -> fully disabled
+ element.tabs( "disable", 0 );
+ tabs_disabled( element, true );
+});
+
+test( "refresh", function() {
+ expect( 27 );
+
+ var element = $( "#tabs1" ).tabs();
+ tabs_state( element, 1, 0, 0 );
+ tabs_disabled( element, false );
+
+ // disable tab via markup
+ element.find( ".ui-tabs-nav li" ).eq( 1 ).addClass( "ui-state-disabled" );
+ element.tabs( "refresh" );
+ tabs_state( element, 1, 0, 0 );
+ tabs_disabled( element, [ 1 ] );
+
+ // add remote tab
+ element.find( ".ui-tabs-nav" ).append( "<li id='newTab'><a href='data/test.html'>new</a></li>" );
+ element.tabs( "refresh" );
+ tabs_state( element, 1, 0, 0, 0 );
+ tabs_disabled( element, [ 1 ] );
+ equals( element.find( "#" + $( "#newTab a" ).attr( "aria-controls" ) ).length, 1,
+ "panel added for remote tab" );
+
+ // remove all tabs
+ element.find( ".ui-tabs-nav li, .ui-tabs-panel" ).remove();
+ element.tabs( "refresh" );
+ tabs_state( element );
+ equals( element.tabs( "option", "active" ), false, "no active tab" );
+
+ // add tabs
+ element.find( ".ui-tabs-nav" )
+ .append( "<li class='ui-state-disabled'><a href='#newTab2'>new 2</a></li>" )
+ .append( "<li><a href='#newTab3'>new 3</a></li>" )
+ .append( "<li><a href='#newTab4'>new 4</a></li>" )
+ .append( "<li><a href='#newTab5'>new 5</a></li>" );
+ element
+ .append( "<div id='newTab2'>new 2</div>" )
+ .append( "<div id='newTab3'>new 3</div>" )
+ .append( "<div id='newTab4'>new 4</div>" )
+ .append( "<div id='newTab5'>new 5</div>" );
+ element.tabs( "refresh" );
+ tabs_state( element, 0, 0, 0, 0 );
+ tabs_disabled( element, [ 0 ] );
+
+ // activate third tab
+ element.tabs( "option", "active", 2 );
+ tabs_state( element, 0, 0, 1, 0 );
+ tabs_disabled( element, [ 0 ] );
+
+ // remove fourth tab, third tab should stay active
+ element.find( ".ui-tabs-nav li" ).eq( 3 ).remove();
+ element.find( ".ui-tabs-panel" ).eq( 3 ).remove();
+ element.tabs( "refresh" );
+ tabs_state( element, 0, 0, 1 );
+ tabs_disabled( element, [ 0 ] );
+
+ // remove third (active) tab, second tab should become active
+ element.find( ".ui-tabs-nav li" ).eq( 2 ).remove();
+ element.find( ".ui-tabs-panel" ).eq( 2 ).remove();
+ element.tabs( "refresh" );
+ tabs_state( element, 0, 1 );
+ tabs_disabled( element, [ 0 ] );
+
+ // remove first tab, previously active tab (now first) should stay active
+ element.find( ".ui-tabs-nav li" ).eq( 0 ).remove();
+ element.find( ".ui-tabs-panel" ).eq( 0 ).remove();
+ element.tabs( "refresh" );
+ tabs_state( element, 1 );
+ tabs_disabled( element, false );
+});
+
+asyncTest( "load", function() {
+ expect( 30 );
+
+ var element = $( "#tabs2" ).tabs();
+
+ // load content of inactive tab
+ // useful for preloading content with custom caching
+ element.one( "tabsbeforeload", function( event, ui ) {
+ var tab = element.find( ".ui-tabs-nav a" ).eq( 3 ),
+ panelId = tab.attr( "aria-controls" ),
+ panel = $( "#" + panelId );
+
+ ok( !( "originalEvent" in event ), "originalEvent" );
+ equals( ui.tab.size(), 1, "tab size" );
+ strictEqual( ui.tab[ 0 ], tab[ 0 ], "tab" );
+ equals( ui.panel.size(), 1, "panel size" );
+ strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" );
+ tabs_state( element, 1, 0, 0, 0, 0 );
+ });
+ element.one( "tabsload", function( event, ui ) {
+ // TODO: remove wrapping in 2.0
+ var uiTab = $( ui.tab ),
+ uiPanel = $( ui.panel );
+
+ var tab = element.find( ".ui-tabs-nav a" ).eq( 3 ),
+ panelId = tab.attr( "aria-controls" ),
+ panel = $( "#" + panelId );
+
+ ok( !( "originalEvent" in event ), "originalEvent" );
+ equals( uiTab.size(), 1, "tab size" );
+ strictEqual( uiTab[ 0 ], tab[ 0 ], "tab" );
+ equals( uiPanel.size(), 1, "panel size" );
+ strictEqual( uiPanel[ 0 ], panel[ 0 ], "panel" );
+ equals( uiPanel.find( "p" ).length, 1, "panel html" );
+ tabs_state( element, 1, 0, 0, 0, 0 );
+ setTimeout( tabsload1, 100 );
+ });
+ element.tabs( "load", 3 );
+ tabs_state( element, 1, 0, 0, 0, 0 );
+
+ function tabsload1() {
+ // no need to test details of event (tested in events tests)
+ element.one( "tabsbeforeload", function() {
+ ok( true, "tabsbeforeload invoked" );
+ });
+ element.one( "tabsload", function() {
+ ok( true, "tabsload invoked" );
+ setTimeout( tabsload2, 100 );
+ });
+ element.tabs( "option", "active", 3 );
+ tabs_state( element, 0, 0, 0, 1, 0 );
+ }
+
+ function tabsload2() {
+ // reload content of active tab
+ element.one( "tabsbeforeload", function( event, ui ) {
+ var tab = element.find( ".ui-tabs-nav a" ).eq( 3 ),
+ panelId = tab.attr( "aria-controls" ),
+ panel = $( "#" + panelId );
+
+ ok( !( "originalEvent" in event ), "originalEvent" );
+ equals( ui.tab.size(), 1, "tab size" );
+ strictEqual( ui.tab[ 0 ], tab[ 0 ], "tab" );
+ equals( ui.panel.size(), 1, "panel size" );
+ strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" );
+ tabs_state( element, 0, 0, 0, 1, 0 );
+ });
+ element.one( "tabsload", function( event, ui ) {
+ // TODO: remove wrapping in 2.0
+ var uiTab = $( ui.tab ),
+ uiPanel = $( ui.panel );
+
+ var tab = element.find( ".ui-tabs-nav a" ).eq( 3 ),
+ panelId = tab.attr( "aria-controls" ),
+ panel = $( "#" + panelId );
+
+ ok( !( "originalEvent" in event ), "originalEvent" );
+ equals( uiTab.size(), 1, "tab size" );
+ strictEqual( uiTab[ 0 ], tab[ 0 ], "tab" );
+ equals( uiPanel.size(), 1, "panel size" );
+ strictEqual( uiPanel[ 0 ], panel[ 0 ], "panel" );
+ tabs_state( element, 0, 0, 0, 1, 0 );
+ start();
+ });
+ element.tabs( "load", 3 );
+ tabs_state( element, 0, 0, 0, 1, 0 );
+ }
+});
+
+}( jQuery ) );
diff --git a/src/main/webapp/jquery-ui-1.9pre/tests/unit/tabs/tabs_options.js b/src/main/webapp/jquery-ui-1.9pre/tests/unit/tabs/tabs_options.js
new file mode 100644
index 0000000..8d61c47
--- /dev/null
+++ b/src/main/webapp/jquery-ui-1.9pre/tests/unit/tabs/tabs_options.js
@@ -0,0 +1,213 @@
+(function( $ ) {
+
+module( "tabs: options" );
+
+test( "{ active: default }", function() {
+ expect( 4 );
+
+ var element = $( "#tabs1" ).tabs();
+ equals( element.tabs( "option", "active" ), 0, "should be 0 by default" );
+ tabs_state( element, 1, 0, 0 );
+ element.tabs( "destroy" );
+
+ location.hash = "#fragment-3";
+ element = $( "#tabs1" ).tabs();
+ equals( element.tabs( "option", "active" ), 2, "should be 2 based on URL" );
+ tabs_state( element, 0, 0, 1 );
+ element.tabs( "destroy" );
+ location.hash = "#";
+});
+
+test( "{ active: false }", function() {
+ expect( 7 );
+
+ var element = $( "#tabs1" ).tabs({
+ active: false,
+ collapsible: true
+ });
+ tabs_state( element, 0, 0, 0 );
+ equal( element.find( ".ui-tabs-nav .ui-state-active" ).size(), 0, "no tabs selected" );
+ strictEqual( element.tabs( "option", "active" ), false );
+
+ element.tabs( "option", "collapsible", false );
+ tabs_state( element, 1, 0, 0 );
+ equal( element.tabs( "option", "active" ), 0 );
+
+ element.tabs( "destroy" );
+ element.tabs({
+ active: false
+ });
+ tabs_state( element, 1, 0, 0 );
+ strictEqual( element.tabs( "option", "active" ), 0 );
+});
+
+test( "{ active: Number }", function() {
+ expect( 8 );
+
+ var element = $( "#tabs1" ).tabs({
+ active: 2
+ });
+ equals( element.tabs( "option", "active" ), 2 );
+ tabs_state( element, 0, 0, 1 );
+
+ element.tabs( "option", "active", 0 );
+ equals( element.tabs( "option", "active" ), 0 );
+ tabs_state( element, 1, 0, 0 );
+
+ element.find( ".ui-tabs-nav a" ).eq( 1 ).click();
+ equals( element.tabs( "option", "active" ), 1 );
+ tabs_state( element, 0, 1, 0 );
+
+ element.tabs( "option", "active", 10 );
+ equals( element.tabs( "option", "active" ), 1 );
+ tabs_state( element, 0, 1, 0 );
+});
+
+if ( $.uiBackCompat === false ) {
+ test( "{ active: -Number }", function() {
+ var element = $( "#tabs1" ).tabs({
+ active: -1
+ });
+ equals( element.tabs( "option", "active" ), 2 );
+ tabs_state( element, 0, 0, 1 );
+
+ element.tabs( "option", "active", -2 );
+ equals( element.tabs( "option", "active" ), 1 );
+ tabs_state( element, 0, 1, 0 );
+
+ element.tabs( "option", "active", -10 );
+ equals( element.tabs( "option", "active" ), 1 );
+ tabs_state( element, 0, 1, 0 );
+
+ element.tabs( "option", "active", -3 );
+ equals( element.tabs( "option", "active" ), 0 );
+ tabs_state( element, 1, 0, 0 );
+ });
+}
+
+test( "active - mismatched tab/panel order", function() {
+ expect( 3 );
+
+ location.hash = "#tabs7-2";
+ var element = $( "#tabs7" ).tabs();
+ equals( element.tabs( "option", "active" ), 1, "should be 1 based on URL" );
+ tabs_state( element, 0, 1 );
+ element.tabs( "option", "active", 0 );
+ tabs_state( element, 1, 0 );
+ location.hash = "#";
+});
+
+test( "{ collapsible: false }", function() {
+ expect( 4 );
+
+ var element = $( "#tabs1" ).tabs({
+ active: 1
+ });
+ element.tabs( "option", "active", false );
+ equal( element.tabs( "option", "active" ), 1 );
+ tabs_state( element, 0, 1, 0 );
+
+ element.find( ".ui-state-active a" ).eq( 1 ).click();
+ equal( element.tabs( "option", "active" ), 1 );
+ tabs_state( element, 0, 1, 0 );
+});
+
+test( "{ collapsible: true }", function() {
+ expect( 6 );
+
+ var element = $( "#tabs1" ).tabs({
+ active: 1,
+ collapsible: true
+ });
+
+ element.tabs( "option", "active", false );
+ equal( element.tabs( "option", "active" ), false );
+ tabs_state( element, 0, 0, 0 );
+
+ element.tabs( "option", "active", 1 );
+ equal( element.tabs( "option", "active" ), 1 );
+ tabs_state( element, 0, 1, 0 );
+
+ element.find( ".ui-state-active a" ).click();
+ equal( element.tabs( "option", "active" ), false );
+ tabs_state( element, 0, 0, 0 );
+});
+
+test( "disabled", function() {
+ expect( 10 );
+
+ // fully enabled by default
+ var element = $( "#tabs1" ).tabs();
+ tabs_disabled( element, false );
+
+ // disable single tab
+ element.tabs( "option", "disabled", [ 1 ] );
+ tabs_disabled( element, [ 1 ] );
+
+ // disabled active tab
+ element.tabs( "option", "disabled", [ 0, 1 ] );
+ tabs_disabled( element, [ 0, 1 ] );
+
+ // disable all tabs
+ element.tabs( "option", "disabled", [ 0, 1, 2 ] );
+ tabs_disabled( element, true );
+
+ // enable all tabs
+ element.tabs( "option", "disabled", [] );
+ tabs_disabled( element, false );
+});
+
+test( "{ event: null }", function() {
+ expect( 5 );
+
+ var element = $( "#tabs1" ).tabs({
+ event: null
+ });
+ tabs_state( element, 1, 0, 0 );
+
+ element.tabs( "option", "active", 1 );
+ equal( element.tabs( "option", "active" ), 1 );
+ tabs_state( element, 0, 1, 0 );
+
+ // ensure default click handler isn't bound
+ element.find( ".ui-tabs-nav a" ).eq( 2 ).click();
+ equal( element.tabs( "option", "active" ), 1 );
+ tabs_state( element, 0, 1, 0 );
+});
+
+test( "{ event: custom }", function() {
+ expect( 11 );
+
+ var element = $( "#tabs1" ).tabs({
+ event: "custom1 custom2"
+ });
+ tabs_state( element, 1, 0, 0 );
+
+ element.find( ".ui-tabs-nav a" ).eq( 1 ).trigger( "custom1" );
+ equal( element.tabs( "option", "active" ), 1 );
+ tabs_state( element, 0, 1, 0 );
+
+ // ensure default click handler isn't bound
+ element.find( ".ui-tabs-nav a" ).eq( 2 ).trigger( "click" );
+ equal( element.tabs( "option", "active" ), 1 );
+ tabs_state( element, 0, 1, 0 );
+
+ element.find( ".ui-tabs-nav a" ).eq( 2 ).trigger( "custom2" );
+ equal( element.tabs( "option", "active" ), 2 );
+ tabs_state( element, 0, 0, 1 );
+
+ element.tabs( "option", "event", "custom3" );
+
+ // ensure old event handlers are unbound
+ element.find( ".ui-tabs-nav a" ).eq( 1 ).trigger( "custom1" );
+ equal( element.tabs( "option", "active" ), 2 );
+ tabs_state( element, 0, 0, 1 );
+
+ element.find( ".ui-tabs-nav a" ).eq( 1 ).trigger( "custom3" );
+ equal( element.tabs( "option", "active" ), 1 );
+ tabs_state( element, 0, 1, 0 );
+});
+
+// TODO: add animation tests
+
+}( jQuery ) );