aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/unit/progressbar/progressbar_methods.js9
-rw-r--r--ui/ui.progressbar.js8
2 files changed, 15 insertions, 2 deletions
diff --git a/tests/unit/progressbar/progressbar_methods.js b/tests/unit/progressbar/progressbar_methods.js
index 9a162685b..a48fa3d47 100644
--- a/tests/unit/progressbar/progressbar_methods.js
+++ b/tests/unit/progressbar/progressbar_methods.js
@@ -24,4 +24,13 @@ test("destroy", function() {
equals(actual, expected, 'destroy is chainable');
});
+test('value', function() {
+ expect(3);
+
+ var el = $('<div></div>').progressbar({ value: 20 });
+ equals(el.progressbar('value'), 20, 'correct value as getter');
+ equals(el.progressbar('value', 30), el, 'chainable as setter');
+ equals(el.progressbar('option', 'value'), 30, 'correct value after setter');
+});
+
})(jQuery);
diff --git a/ui/ui.progressbar.js b/ui/ui.progressbar.js
index 6988f8dff..1cf077cae 100644
--- a/ui/ui.progressbar.js
+++ b/ui/ui.progressbar.js
@@ -56,8 +56,12 @@ $.widget("ui.progressbar", {
},
value: function(newValue) {
- arguments.length && this._setData("value", newValue);
- return this._value();
+ if (newValue === undefined) {
+ return this._value();
+ }
+
+ this._setData('value', newValue);
+ return this;
},
_setData: function(key, value) {