-/*
- * tabs_defaults.js
- */
-
-var tabs_defaults = {
- activate: null,
- beforeload: null,
- beforeActivate: null,
- collapsible: false,
- disabled: false,
- event: "click",
- fx: null,
- load: null
-};
-
-// FAIL: falsy values break the cookie option
-commonWidgetTests( "tabs", { defaults: tabs_defaults } );
+commonWidgetTests( "tabs", {
+ defaults: {
+ activate: null,
+// active: null,
+ beforeLoad: null,
+ beforeActivate: null,
+ collapsible: false,
+ disabled: false,
+ event: "click",
+ fx: null,
+ load: null
+ }
+});
-/*
- * tabs_defaults.js
- */
-
-var tabs_defaults = {
- activate: null,
- add: null,
- ajaxOptions: null,
- beforeload: null,
- beforeActivate: 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…</em>",
- tabTemplate: "<li><a href='#{href}'><span>#{label}</span></a></li>"
-};
-
-// FAIL: falsy values break the cookie option
-commonWidgetTests( "tabs", { defaults: tabs_defaults } );
+commonWidgetTests( "tabs", {
+ defaults: {
+ activate: null,
+// active: null,
+ add: null,
+ ajaxOptions: null,
+ beforeLoad: null,
+ beforeActivate: 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…</em>",
+ tabTemplate: "<li><a href='#{href}'><span>#{label}</span></a></li>"
+ }
+});
$( "#tabs2" ).tabs({
selected: 3,
- beforeload: function( event, ui ) {
+ beforeLoad: function( event, ui ) {
event.preventDefault();
equal( ui.panel.id, "∫ßáö_Սե", "proper title" );
}
element.tabs( "option", "active", 1 );
});
-test('beforeload', function() {
+test( "beforeLoad", function() {
expect( 5 );
- el = $('#tabs2');
+ el = $( "#tabs2" );
el.tabs({
active: 2,
- beforeload: function( event, ui ) {
+ 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');
event.preventDefault();
}
});
-
});
test('load', function() {
el = $('#tabs2').tabs({
active: 2,
- beforeload: function( event, ui ) {
+ beforeLoad: function( event, ui ) {
event.preventDefault();
ok(/test.html$/.test( ui.settings.url ), 'should ignore fragment identifier');
}
el = $('<div><ul><li><a href="#tab">Tab</a></li></ul><div id="tab"></div></div>');
el.appendTo('#main');
el.tabs({
- beforeload: function( event, ui ) {
+ beforeLoad: function( event, ui ) {
event.preventDefault();
ok( false, 'should not be an ajax tab');
}
$.widget( "ui.tabs", {
options: {
activate: null,
- beforeload: null,
+ // TODO: uncomment (requires fixing code related to active option)
+// active: null,
+ beforeLoad: null,
beforeActivate: null,
collapsible: false,
- disabled: false,
event: "click",
fx: null, // e.g. { height: 'toggle', opacity: 'toggle', duration: 200 }
load: null
_setOption: function( key, value ) {
if ( key == "active" ) {
- // _activate() will handle invalid values and update this.option
+ // _activate() will handle invalid values and update this.options
this._activate( value );
- return
- } else {
- this.options[ key ] = value;
- this.refresh();
+ return;
}
+
+ this.options[ key ] = value;
+ this.refresh();
},
_tabId: function( a ) {
this.xhr = $.ajax({
url: url,
beforeSend: function( jqXHR, settings ) {
- return self._trigger( "beforeload", null,
- $.extend( { jqXHR: jqXHR, settings: settings }, eventData ) );
+ // TODO: pass relevant event
+ return self._trigger( "beforeLoad", null,
+ $.extend( { jqXHR : jqXHR, settings: settings }, eventData ) );
}
});
self.element.dequeue( "tabs" );
return this;
- }
+ },
+ _getPanelForTab: function( tab ) {
+ var id = $( tab ).attr( "aria-controls" );
+ return this.element.find( this._sanitizeSelector( "#" + id ) );
+ }
});
$.extend( $.ui.tabs, {
// DEPRECATED
if ( $.uiBackCompat !== false ) {
-
// ajaxOptions and cache options
(function( $, prototype ) {
$.extend( prototype.options, {