mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Progressbar: Added a complete event. Fixes #3500 - Progressbar callback at the end.
This commit is contained in:
parent
adcafce7a2
commit
0b6710aed7
@ -14,4 +14,25 @@ test("change", function() {
|
||||
}).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);
|
||||
|
3
ui/jquery.ui.progressbar.js
vendored
3
ui/jquery.ui.progressbar.js
vendored
@ -64,6 +64,9 @@ $.widget( "ui.progressbar", {
|
||||
this.options.value = value;
|
||||
this._refreshValue();
|
||||
this._trigger( "change" );
|
||||
if ( this._value() === this.max ) {
|
||||
this._trigger( "complete" );
|
||||
}
|
||||
}
|
||||
|
||||
$.Widget.prototype._setOption.apply( this, arguments );
|
||||
|
Loading…
Reference in New Issue
Block a user