Skip to content
Permalink
Browse files

Progressbar: Modified value method to act as both a getter and setter…

…. Fixed #4427 - progressbar('value') returns a reference to this instead of the value.
  • Loading branch information...
scottgonzalez committed Apr 16, 2009
1 parent 1195854 commit 62f11b4a2ee8a8c10c51d614e37af1f0216385db
Showing with 15 additions and 2 deletions.
  1. +9 −0 tests/unit/progressbar/progressbar_methods.js
  2. +6 −2 ui/ui.progressbar.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);
@@ -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) {

0 comments on commit 62f11b4

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