Skip to content
Permalink
Browse files

Progressbar: Added a complete event. Fixes #3500 - Progressbar callba…

…ck at the end.
  • Loading branch information
scottgonzalez committed Sep 27, 2010
1 parent adcafce commit 0b6710aed7fc9a9412a975c9f70d3fd6a87c4b02
Showing with 24 additions and 0 deletions.
  1. +21 −0 tests/unit/progressbar/progressbar_events.js
  2. +3 −0 ui/jquery.ui.progressbar.js
@@ -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);
@@ -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 );

0 comments on commit 0b6710a

Please sign in to comment.
You can’t perform that action at this time.