Skip to content

Commit

Permalink
Tabs: Only trigger tabsload on success.
Browse files Browse the repository at this point in the history
  • Loading branch information
scottgonzalez committed May 9, 2011
1 parent 0adeb9b commit 9ea6db6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
7 changes: 5 additions & 2 deletions tests/unit/tabs/tabs_deprecated.js
Expand Up @@ -156,8 +156,11 @@ asyncTest( "spinner", function() {
equals( element.find( ".ui-tabs-nav li:eq(2) em" ).length, 1, "beforeload" );
});
element.one( "tabsload", function( event, ui ) {
equals( element.find( ".ui-tabs-nav li:eq(2) em" ).length, 0, "load" );
start();
// 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 );
});
Expand Down
5 changes: 2 additions & 3 deletions ui/jquery.ui.tabs.js
Expand Up @@ -621,6 +621,7 @@ $.widget( "ui.tabs", {
this.xhr
.success(function( response ) {
panel.html( response );
self._trigger( "load", event, eventData );
})
.complete(function( jqXHR, status ) {
if ( status === "abort" ) {
Expand All @@ -631,13 +632,11 @@ $.widget( "ui.tabs", {
// "tabs" queue must not contain more than two elements,
// which are the callbacks for the latest clicked tab...
self.element.queue( "tabs", self.element.queue( "tabs" ).splice( -2, 2 ) );

delete this.xhr;
}

self.lis.eq( index ).removeClass( "ui-tabs-loading" );

self._trigger( "load", event, eventData );
delete self.xhr;
});
}

Expand Down

0 comments on commit 9ea6db6

Please sign in to comment.