mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Slider: Properly handle value and value methods as setters. Fixes #4881 - Slider: value and values methods as setters aren't chainable.
(cherry picked from commit 2197c61f1f
)
This commit is contained in:
parent
eb3d955438
commit
8310d185b3
@ -74,7 +74,7 @@ test("value", function() {
|
||||
value: 5
|
||||
});
|
||||
equals(el.slider('value'), 5, 'range: ' + this + ' slider method get');
|
||||
el.slider('value', 10);
|
||||
equals(el.slider('value', 10), el, 'value method is chainable');
|
||||
equals(el.slider('value'), 10, 'range: ' + this + ' slider method set');
|
||||
el.remove();
|
||||
});
|
||||
@ -85,13 +85,13 @@ test("value", function() {
|
||||
el.slider('option', 'value', -2);
|
||||
equals(el.slider('option', 'value'), -2, 'value option does not respect min');
|
||||
equals(el.slider('value'), -1, 'value method get respects min');
|
||||
el.slider('value', -2);
|
||||
equals(el.slider('value', -2), el, 'value method is chainable');
|
||||
equals(el.slider('option', 'value'), -1, 'value method set respects min');
|
||||
// max with value option vs value method
|
||||
el.slider('option', 'value', 2);
|
||||
equals(el.slider('option', 'value'), 2, 'value option does not respect max');
|
||||
equals(el.slider('value'), 1, 'value method get respects max');
|
||||
el.slider('value', 2);
|
||||
equals(el.slider('value', 2), el, 'value method is chainable');
|
||||
equals(el.slider('option', 'value'), 1, 'value method set respects max');
|
||||
});
|
||||
|
||||
|
2
ui/jquery.ui.slider.js
vendored
2
ui/jquery.ui.slider.js
vendored
@ -466,6 +466,7 @@ $.widget( "ui.slider", $.ui.mouse, {
|
||||
this.options.value = this._trimAlignValue( newValue );
|
||||
this._refreshValue();
|
||||
this._change( null, 0 );
|
||||
return;
|
||||
}
|
||||
|
||||
return this._value();
|
||||
@ -480,6 +481,7 @@ $.widget( "ui.slider", $.ui.mouse, {
|
||||
this.options.values[ index ] = this._trimAlignValue( newValue );
|
||||
this._refreshValue();
|
||||
this._change( null, index );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( arguments.length ) {
|
||||
|
Loading…
Reference in New Issue
Block a user