aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/unit/progressbar/progressbar_events.js21
-rw-r--r--ui/jquery.ui.progressbar.js3
2 files changed, 24 insertions, 0 deletions
diff --git a/tests/unit/progressbar/progressbar_events.js b/tests/unit/progressbar/progressbar_events.js
index b273cd5e9..22b301abe 100644
--- a/tests/unit/progressbar/progressbar_events.js
+++ b/tests/unit/progressbar/progressbar_events.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);
diff --git a/ui/jquery.ui.progressbar.js b/ui/jquery.ui.progressbar.js
index e0b728f1a..5347e026b 100644
--- a/ui/jquery.ui.progressbar.js
+++ b/ui/jquery.ui.progressbar.js
@@ -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 );