Progressbar: Added a complete event. Fixes #3500 - Progressbar callback at the end.

This commit is contained in:
Scott González 2010-09-27 10:44:04 -04:00
parent adcafce7a2
commit 0b6710aed7
2 changed files with 24 additions and 0 deletions

View File

@ -14,4 +14,25 @@ test("change", function() {
}).progressbar("value", 5); }).progressbar("value", 5);
}); });
test( "complete", function() {
expect( 3 );
var changes = 0,
value;
$( "#progressbar" ).progressbar({
change: function() {
changes++;
same( $( this ).progressbar( "value" ), value, "change at " + value );
},
complete: function() {
equal( changes, 2, "complete triggered after change" );
}
});
value = 5;
$( "#progressbar" ).progressbar( "value", value );
value = 100;
$( "#progressbar" ).progressbar( "value", value );
});
})(jQuery); })(jQuery);

View File

@ -64,6 +64,9 @@ $.widget( "ui.progressbar", {
this.options.value = value; this.options.value = value;
this._refreshValue(); this._refreshValue();
this._trigger( "change" ); this._trigger( "change" );
if ( this._value() === this.max ) {
this._trigger( "complete" );
}
} }
$.Widget.prototype._setOption.apply( this, arguments ); $.Widget.prototype._setOption.apply( this, arguments );