jQRangeSlider
jQRangeSlider copied to clipboard
Indicate which handle was manipulated on change.
Provides a 'lastHandle' parameter that is part of 'trigger' which will be left,middle or right.
Demo page updated.
Fixes #67
Thanks for your pull request.
Can you create tests for this new feature? I'll be glad to integrate it once tested.
Thanks.
Thanks for your modifications.
Can you test the 3 possible values? After that, I'll merge your request.
I'm having some difficulty with the async nature of these tests...that is, properly ending each test and moving on to the next one.I try to unbind the event after the first callback but it doesn't seem to be working.The test results 'fall thru' to the next one in line. ideas?
I thought the callback should be like
$(el).off('valuesChanging');
QUnit.equal(data.lastHandle,'right', "Last Handle should be right");
start()
I suggest you to write your test the other way around.
- Bind your event
- Change the values
- Check that you callback had been called.
If you change values before setting up the binding, you'll not be able to catch the event.
Can I do something to help you with this pull request? Are you stuck on something?
So the code I listed above was the callback I'm using for valuesChanging...so I am already doing what you are suggesting I believe...but the problem is I cannot seem to stop the event firing after the first time, and so the events 'fall down'. Take a look at my newest commit to see what I mean. The "Issue 12" test seems to catch the handle drag firing and thinks its part of its test.
I suggest you to move all your code in the first method.
In the second method, verify that your callback was called (because your test will be OK even if the event was not fired at all).
It should do the job.
Ok, I ran your test, and I know what's going wrong:
- I had to transform it to run it correctly:
var handleLeftTest = new TestCase(
"Handle left",
function(){
var self = this;
$(el).on('valuesChanging', function(e,data) {
self.leftResult = data.lastHandle;
});
var leftHandle = el.find(".ui-rangeSlider-leftHandle");
setTimeout(function(){
leftHandle.simulate("drag", {
dx: el.find(".ui-rangeSlider-container").innerWidth() - leftHandle.position().left,
dy: 0
});
}, 100);
this.delay = 500;
},
function(){
QUnit.equal(this.leftResult,'left', "Last Handle should be left");
}
);
- Now it fails, but it seems to be ok for me, because the left handle is dragged totally on the right. There is a moment where it becomes the right handle. And your code returns "middle" in this case.
Hi, any updates on this ? It would indeed be quite useful for some advanced uses.
Any updates?? I'd love to see it work
For the moment, tests are failing. I don't have any other updates on the subject.
Hi Guillaume; Great control, 10x for sharing it. I've managed to do it for my purpose. I needed to have two spinners for changing the handlers value by single step, using some code I have it fully functional. I't won't suit the general product
[image: Inline image 1]
Thank again, David
On Thu, Jun 12, 2014 at 12:21 PM, Guillaume Gautreau < [email protected]> wrote:
For the moment, tests are failing. I don't have any other updates on the subject.
— Reply to this email directly or view it on GitHub https://github.com/ghusse/jQRangeSlider/pull/101#issuecomment-45847086.
I can't see the image, but I'm glad you managed to do it on your own.
@ghusse let me see if I can jump back into this over the next few days and submit a revised pull. Sorry for the delay.