-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Slider: Fix to restrict handle values when set programmatically. #1479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
ui/slider.js
Outdated
@@ -157,6 +158,48 @@ return $.widget( "ui.slider", $.ui.mouse, { | |||
} | |||
}, | |||
|
|||
_cleanValues: function( index, newValue ) { | |||
var i = 0, values ; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uninitialized variables go at the top:
var values,
i = 0;
There are some spacing issues and I didn't do a full review because it looks like this still needs some changes to how it works. |
8fd5751
to
8c75382
Compare
@dekajp please comment on your PRs after you push an update, since the push itself has no notification. @scottgonzalez there's a new commit since yesterday |
ui/slider.js
Outdated
@@ -422,6 +465,7 @@ return $.widget( "ui.slider", $.ui.mouse, { | |||
this._refreshValue(); | |||
} else { | |||
if ( this.options.values && this.options.values.length ) { | |||
this.options.values = this._cleanValues( this.options.values ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are the values being cleaned during a get?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will change this and move _cleanValues
to create
Maybe we should start with just a set of tests so that we can agree the correct behavior is being tested. |
do you want me to add/modify the unit test cases ? |
7c921d3
to
296e454
Compare
From http://bugs.jqueryui.com/ticket/3762#comment:31
|
@scottgonzalez , i will send a new PR on this. |
tests/unit/slider/slider_methods.js
Outdated
element.slider( "values", 1, 75 ); | ||
equal( element.slider( "values", 1 ), 75, "Values (index,value) - set second handle" ); | ||
|
||
element.slider( "values", [ 50, 75 ] ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is effectively a no-op. Why is it here?
@dekajp What's the status of this? |
@scottgonzalez last 3 weeks i was busy with relocation. i think this weekend i will be able to get back on this |
Thanks. Hope the move went well. |
7dd5ce8
to
b65c3bb
Compare
@scottgonzalez yeah move went all , everyone happy in family :) with more space . I rebased commits . |
equal( element.slider( "values", 0 ), 10, "Values (index,value) - 1st handle restricted properly, against min" ); | ||
|
||
element.slider( "values", 0, 90 ); | ||
equal( element.slider( "values", 0 ), element.slider( "values", 1 ), "Values (index,value) - 1st handle restricted properly, against 2nd handle" ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand that you're trying to show that the handles are matching, but I'd prefer an explicit value for the expected value.
@dekajp would you be available to rebase this and update the implementation? |
Fixes #3762 - Slider: handles not restricted properly when set programmatically
b65c3bb
to
7365b58
Compare
@jzaefferer i rebased by commit. I will look into update the implementation |
I have dynamic multiple input and dynamic slider handle so when on change input text value need to set slider value but I can't set slider handle check below code .
Note :Please let me if needed full code. |
Closing as a stale branch. |
Fixes #3762 - Slider: handles not restricted properly when set programmatically