diff --git a/tests/specs/helper.js b/tests/specs/helper.js index cbe1969..ce6d1a9 100644 --- a/tests/specs/helper.js +++ b/tests/specs/helper.js @@ -108,9 +108,12 @@ $timeout.flush(); }; - h.mouseMoveToValue = function(value) { - var offset = h.slider.valueToOffset(value) + h.slider.handleHalfDim + h.slider.sliderElem.rzsp; - h.fireMousemove(offset); + h.getMousePosition = function(value) { + return h.slider.valueToOffset(value) + h.slider.handleHalfDim + h.slider.sliderElem.rzsp; + }; + + h.moveMouseToValue = function(value) { + h.fireMousemove(h.getMousePosition(value)); }; return h; diff --git a/tests/specs/mouse-controls/draggable-range-slider-horizontal-test.js b/tests/specs/mouse-controls/draggable-range-slider-horizontal-test.js index d78bef0..e3af744 100644 --- a/tests/specs/mouse-controls/draggable-range-slider-horizontal-test.js +++ b/tests/specs/mouse-controls/draggable-range-slider-horizontal-test.js @@ -41,9 +41,8 @@ sinon.spy(helper.slider, 'positionTrackingHandle'); sinon.spy(helper.slider, 'callOnChange'); var event = helper.fireMousedown(helper.slider.minH, 0); - var expectedValue = 50, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 50; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.min).to.equal(expectedValue); helper.slider.positionTrackingHandle.called.should.be.true; helper.slider.callOnChange.called.should.be.true; @@ -53,9 +52,8 @@ sinon.spy(helper.slider, 'positionTrackingHandle'); sinon.spy(helper.slider, 'callOnChange'); var event = helper.fireMousedown(helper.slider.maxH, 0); - var expectedValue = 50, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 50; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.max).to.equal(expectedValue); helper.slider.positionTrackingHandle.called.should.be.true; helper.slider.callOnChange.called.should.be.true; @@ -63,9 +61,8 @@ it('should handle click and drag on minH and switch min/max if needed', function() { var event = helper.fireMousedown(helper.slider.minH, 0); - var expectedValue = 80, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 80; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.min).to.equal(60); expect(helper.scope.slider.max).to.equal(80); @@ -73,9 +70,8 @@ it('should handle click and drag on maxH and switch min/max if needed', function() { var event = helper.fireMousedown(helper.slider.maxH, 0); - var expectedValue = 20, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 20; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.min).to.equal(20); expect(helper.scope.slider.max).to.equal(40); @@ -88,7 +84,7 @@ sinon.spy(helper.slider, 'focusElement'); var expectedValue = 10, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; + offset = helper.getMousePosition(expectedValue); var event = helper.fireMousedown(helper.slider.fullBar, offset); @@ -107,7 +103,7 @@ sinon.spy(helper.slider, 'focusElement'); var expectedValue = 90, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; + offset = helper.getMousePosition(expectedValue); var event = helper.fireMousedown(helper.slider.fullBar, offset); @@ -244,7 +240,7 @@ sinon.spy(helper.slider, 'callOnChange'); var event = helper.fireMousedown(helper.slider.minH, 0); var expectedValue = 50, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; + offset = helper.getMousePosition(expectedValue); helper.fireMousemove(offset); expect(helper.scope.slider.min).to.equal(expectedValue); helper.slider.positionTrackingHandle.called.should.be.true; @@ -256,7 +252,7 @@ sinon.spy(helper.slider, 'callOnChange'); var event = helper.fireMousedown(helper.slider.maxH, 0); var expectedValue = 50, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; + offset = helper.getMousePosition(expectedValue); helper.fireMousemove(offset); expect(helper.scope.slider.max).to.equal(expectedValue); helper.slider.positionTrackingHandle.called.should.be.true; @@ -266,7 +262,7 @@ it('should handle click and drag on minH and switch min/max if needed', function() { var event = helper.fireMousedown(helper.slider.minH, 0); var expectedValue = 80, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; + offset = helper.getMousePosition(expectedValue); helper.fireMousemove(offset); expect(helper.scope.slider.min).to.equal(60); @@ -276,7 +272,7 @@ it('should handle click and drag on maxH and switch min/max if needed', function() { var event = helper.fireMousedown(helper.slider.maxH, 0); var expectedValue = 20, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; + offset = helper.getMousePosition(expectedValue); helper.fireMousemove(offset); expect(helper.scope.slider.min).to.equal(20); @@ -290,7 +286,7 @@ sinon.spy(helper.slider, 'focusElement'); var expectedValue = 10, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; + offset = helper.getMousePosition(expectedValue); var event = helper.fireMousedown(helper.slider.fullBar, offset); @@ -309,7 +305,7 @@ sinon.spy(helper.slider, 'focusElement'); var expectedValue = 90, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; + offset = helper.getMousePosition(expectedValue); var event = helper.fireMousedown(helper.slider.fullBar, offset); diff --git a/tests/specs/mouse-controls/minMaxLimit-range-slider-horizontal-test.js b/tests/specs/mouse-controls/minMaxLimit-range-slider-horizontal-test.js index d1b8557..091ca65 100644 --- a/tests/specs/mouse-controls/minMaxLimit-range-slider-horizontal-test.js +++ b/tests/specs/mouse-controls/minMaxLimit-range-slider-horizontal-test.js @@ -40,33 +40,29 @@ it('should be able to modify minH above minLimit', function() { helper.fireMousedown(helper.slider.minH, 0); - var expectedValue = 42, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 42; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.min).to.equal(42); }); it('should not be able to modify minH below minLimit', function() { helper.fireMousedown(helper.slider.minH, 0); - var expectedValue = 30, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 30; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.min).to.equal(40); }); it('should be able to modify maxH below maxLimit', function() { helper.fireMousedown(helper.slider.maxH, 0); - var expectedValue = 58, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 58; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.max).to.equal(58); }); it('should not be able to modify maxH above maxLimit', function() { helper.fireMousedown(helper.slider.maxH, 0); - var expectedValue = 70, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 70; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.max).to.equal(60); }); }); @@ -111,33 +107,29 @@ it('should be able to modify minH above minLimit', function() { helper.fireMousedown(helper.slider.minH, 0); - var expectedValue = 42, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 42; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.min).to.equal(42); }); it('should not be able to modify minH below minLimit', function() { helper.fireMousedown(helper.slider.minH, 0); - var expectedValue = 30, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 30; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.min).to.equal(40); }); it('should be able to modify maxH below maxLimit', function() { helper.fireMousedown(helper.slider.maxH, 0); - var expectedValue = 58, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 58; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.max).to.equal(58); }); it('should not be able to modify maxH above maxLimit', function() { helper.fireMousedown(helper.slider.maxH, 0); - var expectedValue = 70, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 70; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.max).to.equal(60); }); }); diff --git a/tests/specs/mouse-controls/minMaxLimit-single-slider-horizontal-test.js b/tests/specs/mouse-controls/minMaxLimit-single-slider-horizontal-test.js index 9921e5d..5e99aa2 100644 --- a/tests/specs/mouse-controls/minMaxLimit-single-slider-horizontal-test.js +++ b/tests/specs/mouse-controls/minMaxLimit-single-slider-horizontal-test.js @@ -39,33 +39,29 @@ it('should be able to modify minH above minLimit', function() { helper.fireMousedown(helper.slider.minH, 0); - var expectedValue = 42, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 42; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.value).to.equal(42); }); it('should not be able to modify minH below minLimit', function() { helper.fireMousedown(helper.slider.minH, 0); - var expectedValue = 30, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 30; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.value).to.equal(40); }); it('should be able to modify minH below maxLimit', function() { helper.fireMousedown(helper.slider.minH, 0); - var expectedValue = 58, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 58; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.value).to.equal(58); }); it('should not be able to modify minH above maxLimit', function() { helper.fireMousedown(helper.slider.minH, 0); - var expectedValue = 70, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 70; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.value).to.equal(60); }); }); @@ -109,33 +105,29 @@ it('should be able to modify minH above minLimit', function() { helper.fireMousedown(helper.slider.minH, 0); - var expectedValue = 42, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 42; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.value).to.equal(42); }); it('should not be able to modify minH below minLimit', function() { helper.fireMousedown(helper.slider.minH, 0); - var expectedValue = 30, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 30; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.value).to.equal(40); }); it('should be able to modify minH below maxLimit', function() { helper.fireMousedown(helper.slider.minH, 0); - var expectedValue = 58, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 58; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.value).to.equal(58); }); it('should not be able to modify minH above maxLimit', function() { helper.fireMousedown(helper.slider.minH, 0); - var expectedValue = 70, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 70; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.value).to.equal(60); }); }); diff --git a/tests/specs/mouse-controls/minMaxRange-noSwitching-range-slider-horizontal-test.js b/tests/specs/mouse-controls/minMaxRange-noSwitching-range-slider-horizontal-test.js index fed10f3..762cf7c 100644 --- a/tests/specs/mouse-controls/minMaxRange-noSwitching-range-slider-horizontal-test.js +++ b/tests/specs/mouse-controls/minMaxRange-noSwitching-range-slider-horizontal-test.js @@ -40,50 +40,44 @@ it('should not modify any value if new range would be smaller than minRange when moving minH', function() { helper.fireMousedown(helper.slider.minH, 0); - var expectedValue = 50, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 50; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.min).to.equal(45); }); it('should not modify any value if new range would be smaller than minRange when moving maxH', function() { helper.fireMousedown(helper.slider.maxH, 0); - var expectedValue = 50, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 50; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.max).to.equal(55); }); it('should modify the min value if new range is larger than minRange when moving minH', function() { helper.fireMousedown(helper.slider.minH, 0); - var expectedValue = 30, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 30; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.min).to.equal(expectedValue); }); it('should modify the max value if new range is larger than than minRange when moving maxH', function() { helper.fireMousedown(helper.slider.maxH, 0); - var expectedValue = 70, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 70; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.max).to.equal(expectedValue); }); it('should not switch min/max when moving minH even if the range is large enough', function() { helper.fireMousedown(helper.slider.minH, 0); - var expectedValue = 80, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 80; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.min).to.equal(45); expect(helper.scope.slider.max).to.equal(55); }); it('should not switch min/max when moving maxH even if the range is large enough', function() { helper.fireMousedown(helper.slider.maxH, 0); - var expectedValue = 20, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 20; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.min).to.equal(45); expect(helper.scope.slider.max).to.equal(55); }); @@ -130,7 +124,7 @@ it('should not modify any value if new range would be smaller than minRange when moving minH', function() { helper.fireMousedown(helper.slider.minH, 0); var expectedValue = 50, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; + offset = helper.getMousePosition(expectedValue); helper.fireMousemove(-offset); expect(helper.scope.slider.min).to.equal(45); }); @@ -138,31 +132,29 @@ it('should not modify any value if new range would be smaller than minRange when moving maxH', function() { helper.fireMousedown(helper.slider.maxH, 0); var expectedValue = 50, - offset = helper.slider.maxPos - (helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp); + offset = helper.slider.maxPos - helper.getMousePosition(expectedValue); helper.fireMousemove(offset); expect(helper.scope.slider.max).to.equal(55); }); it('should modify the min value if new range is larger than minRange when moving minH', function() { helper.fireMousedown(helper.slider.minH, 0); - var expectedValue = 30, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 30; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.min).to.equal(expectedValue); }); it('should modify the max value if new range is larger than than minRange when moving maxH', function() { helper.fireMousedown(helper.slider.maxH, 0); - var expectedValue = 70, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 70; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.max).to.equal(expectedValue); }); it('should not switch min/max when moving minH even if the range is large enough', function() { helper.fireMousedown(helper.slider.minH, 0); var expectedValue = 80, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; + offset = helper.getMousePosition(expectedValue); helper.fireMousemove(-offset); expect(helper.scope.slider.min).to.equal(45); expect(helper.scope.slider.max).to.equal(55); @@ -170,9 +162,8 @@ it('should not switch min/max when moving maxH even if the range is large enough', function() { helper.fireMousedown(helper.slider.maxH, 0); - var expectedValue = 20, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 20; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.min).to.equal(45); expect(helper.scope.slider.max).to.equal(55); }); diff --git a/tests/specs/mouse-controls/minMaxRange-range-slider-horizontal-test.js b/tests/specs/mouse-controls/minMaxRange-range-slider-horizontal-test.js index cacaed1..b318ffe 100644 --- a/tests/specs/mouse-controls/minMaxRange-range-slider-horizontal-test.js +++ b/tests/specs/mouse-controls/minMaxRange-range-slider-horizontal-test.js @@ -39,50 +39,44 @@ it('should not modify any value if new range would be smaller than minRange when moving minH', function() { helper.fireMousedown(helper.slider.minH, 0); - var expectedValue = 50, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 50; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.min).to.equal(45); }); it('should not modify any value if new range would be smaller than minRange when moving maxH', function() { helper.fireMousedown(helper.slider.maxH, 0); - var expectedValue = 50, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 50; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.max).to.equal(55); }); it('should modify the min value if new range is larger than minRange when moving minH', function() { helper.fireMousedown(helper.slider.minH, 0); - var expectedValue = 30, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 30; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.min).to.equal(expectedValue); }); it('should modify the max value if new range is larger than than minRange when moving maxH', function() { helper.fireMousedown(helper.slider.maxH, 0); - var expectedValue = 70, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 70; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.max).to.equal(expectedValue); }); it('should modify the min value if switch min/max with a value large enough', function() { helper.fireMousedown(helper.slider.minH, 0); - var expectedValue = 80, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 80; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.min).to.equal(55); expect(helper.scope.slider.max).to.equal(expectedValue); }); it('should modify the max value if switch min/max with a value large enough', function() { helper.fireMousedown(helper.slider.maxH, 0); - var expectedValue = 20, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 20; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.min).to.equal(expectedValue); expect(helper.scope.slider.max).to.equal(45); }); @@ -126,33 +120,29 @@ it('should not modify any value if new range would be larger than maxRange when moving minH', function() { helper.fireMousedown(helper.slider.minH, 0); - var expectedValue = 30, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 30; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.min).to.equal(45); }); it('should not modify any value if new range would be larger than maxRange when moving maxH', function() { helper.fireMousedown(helper.slider.maxH, 0); - var expectedValue = 70, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 70; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.max).to.equal(55); }); it('should modify the min value if new range is smaller than maxRange when moving minH', function() { helper.fireMousedown(helper.slider.minH, 0); - var expectedValue = 50, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 50; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.min).to.equal(expectedValue); }); it('should modify the max value if new range is smaller than than maxRange when moving maxH', function() { helper.fireMousedown(helper.slider.maxH, 0); - var expectedValue = 50, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 50; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.max).to.equal(expectedValue); }); }); @@ -197,50 +187,44 @@ it('should not modify any value if new range would be smaller than minRange when moving minH', function() { helper.fireMousedown(helper.slider.minH, 0); - var expectedValue = 50, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 50; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.min).to.equal(45); }); it('should not modify any value if new range would be smaller than minRange when moving maxH', function() { helper.fireMousedown(helper.slider.maxH, 0); - var expectedValue = 50, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 50; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.max).to.equal(55); }); it('should modify the min value if new range is larger than minRange when moving minH', function() { helper.fireMousedown(helper.slider.minH, 0); - var expectedValue = 30, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 30; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.min).to.equal(expectedValue); }); it('should modify the max value if new range is larger than than minRange when moving maxH', function() { helper.fireMousedown(helper.slider.maxH, 0); - var expectedValue = 70, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 70; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.max).to.equal(expectedValue); }); it('should modify the min value if switch min/max with a value large enough', function() { helper.fireMousedown(helper.slider.minH, 0); - var expectedValue = 80, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 80; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.min).to.equal(55); expect(helper.scope.slider.max).to.equal(expectedValue); }); it('should modify the max value if switch min/max with a value large enough', function() { helper.fireMousedown(helper.slider.maxH, 0); - var expectedValue = 20, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 20; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.min).to.equal(expectedValue); expect(helper.scope.slider.max).to.equal(45); }); diff --git a/tests/specs/mouse-controls/noSwitching-range-slider-horizontal-test.js b/tests/specs/mouse-controls/noSwitching-range-slider-horizontal-test.js index dc3154c..76c7f58 100644 --- a/tests/specs/mouse-controls/noSwitching-range-slider-horizontal-test.js +++ b/tests/specs/mouse-controls/noSwitching-range-slider-horizontal-test.js @@ -39,17 +39,15 @@ it('should not switch min and max handles if minH is dragged after maxH', function() { helper.fireMousedown(helper.slider.minH, 0); - var expectedValue = 60, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 60; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.min).to.equal(55); }); it('should not switch min and max handles if maxH is dragged before minH', function() { helper.fireMousedown(helper.slider.maxH, 0); - var expectedValue = 20, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 20; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.max).to.equal(45); }); @@ -58,7 +56,7 @@ helper.scope.$digest(); var expectedValue = 30, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; + offset = helper.getMousePosition(expectedValue); helper.fireMousedown(helper.slider.fullBar, offset); @@ -71,7 +69,7 @@ helper.scope.$digest(); var expectedValue = 70, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; + offset = helper.getMousePosition(expectedValue); helper.fireMousedown(helper.slider.fullBar, offset); @@ -119,17 +117,15 @@ it('should not switch min and max handles if minH is dragged after maxH', function() { helper.fireMousedown(helper.slider.minH, 0); - var expectedValue = 60, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 60; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.min).to.equal(55); }); it('should not switch min and max handles if maxH is dragged before minH', function() { helper.fireMousedown(helper.slider.maxH, 0); - var expectedValue = 20, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 20; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.max).to.equal(45); }); @@ -138,7 +134,7 @@ helper.scope.$digest(); var expectedValue = 30, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; + offset = helper.getMousePosition(expectedValue); helper.fireMousedown(helper.slider.fullBar, offset); @@ -151,7 +147,7 @@ helper.scope.$digest(); var expectedValue = 70, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; + offset = helper.getMousePosition(expectedValue); helper.fireMousedown(helper.slider.fullBar, offset); diff --git a/tests/specs/mouse-controls/onlyBindHandles-single-slider-horizontal-test.js b/tests/specs/mouse-controls/onlyBindHandles-single-slider-horizontal-test.js index 05ae7c1..7b6fdc8 100644 --- a/tests/specs/mouse-controls/onlyBindHandles-single-slider-horizontal-test.js +++ b/tests/specs/mouse-controls/onlyBindHandles-single-slider-horizontal-test.js @@ -41,9 +41,8 @@ sinon.spy(helper.slider, 'positionTrackingHandle'); sinon.spy(helper.slider, 'callOnChange'); helper.fireMousedown(helper.slider.minH, 0); - var expectedValue = 50, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 50; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.value).to.equal(expectedValue); helper.slider.positionTrackingHandle.called.should.be.true; helper.slider.callOnChange.called.should.be.true; @@ -104,9 +103,8 @@ sinon.spy(helper.slider, 'positionTrackingHandle'); sinon.spy(helper.slider, 'callOnChange'); helper.fireMousedown(helper.slider.minH, 0); - var expectedValue = 50, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 50; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.value).to.equal(expectedValue); helper.slider.positionTrackingHandle.called.should.be.true; helper.slider.callOnChange.called.should.be.true; diff --git a/tests/specs/mouse-controls/pushRange-range-slider-horizontal-test.js b/tests/specs/mouse-controls/pushRange-range-slider-horizontal-test.js index 1a0e1e9..3de2012 100644 --- a/tests/specs/mouse-controls/pushRange-range-slider-horizontal-test.js +++ b/tests/specs/mouse-controls/pushRange-range-slider-horizontal-test.js @@ -39,28 +39,28 @@ it('should push maxH when moving minH above it', function() { helper.fireMousedown(helper.slider.minH, 0); - helper.mouseMoveToValue(60); + helper.moveMouseToValue(60); expect(helper.scope.slider.min).to.equal(60); expect(helper.scope.slider.max).to.equal(61); }); it('should push minH when moving maxH below it', function() { helper.fireMousedown(helper.slider.maxH, 0); - helper.mouseMoveToValue(40); + helper.moveMouseToValue(40); expect(helper.scope.slider.min).to.equal(39); expect(helper.scope.slider.max).to.equal(40); }); it('should not move maxH above ceil when moving minH to ceil', function() { helper.fireMousedown(helper.slider.minH, 0); - helper.mouseMoveToValue(100); + helper.moveMouseToValue(100); expect(helper.scope.slider.min).to.equal(99); expect(helper.scope.slider.max).to.equal(100); }); it('should not move minH below floor when moving maxH to floor', function() { helper.fireMousedown(helper.slider.maxH, 0); - helper.mouseMoveToValue(0); + helper.moveMouseToValue(0); expect(helper.scope.slider.min).to.equal(0); expect(helper.scope.slider.max).to.equal(1); }); @@ -70,7 +70,7 @@ helper.scope.$digest(); helper.fireMousedown(helper.slider.minH, 0); - helper.mouseMoveToValue(60); + helper.moveMouseToValue(60); expect(helper.scope.slider.min).to.equal(60); expect(helper.scope.slider.max).to.equal(65); }); @@ -80,7 +80,7 @@ helper.scope.$digest(); helper.fireMousedown(helper.slider.maxH, 0); - helper.mouseMoveToValue(40); + helper.moveMouseToValue(40); expect(helper.scope.slider.min).to.equal(35); expect(helper.scope.slider.max).to.equal(40); }); @@ -91,7 +91,7 @@ helper.scope.$digest(); helper.fireMousedown(helper.slider.minH, 0); - helper.mouseMoveToValue(60); + helper.moveMouseToValue(60); expect(helper.scope.slider.min).to.equal(60); expect(helper.scope.slider.max).to.equal(70); }); @@ -102,7 +102,7 @@ helper.scope.$digest(); helper.fireMousedown(helper.slider.maxH, 0); - helper.mouseMoveToValue(40); + helper.moveMouseToValue(40); expect(helper.scope.slider.min).to.equal(30); expect(helper.scope.slider.max).to.equal(40); }); @@ -113,7 +113,7 @@ helper.scope.$digest(); helper.fireMousedown(helper.slider.minH, 0); - helper.mouseMoveToValue(60); + helper.moveMouseToValue(60); expect(helper.scope.slider.min).to.equal(60); expect(helper.scope.slider.max).to.equal(60); }); @@ -124,7 +124,7 @@ helper.scope.$digest(); helper.fireMousedown(helper.slider.maxH, 0); - helper.mouseMoveToValue(40); + helper.moveMouseToValue(40); expect(helper.scope.slider.min).to.equal(40); expect(helper.scope.slider.max).to.equal(40); }); diff --git a/tests/specs/mouse-controls/range-slider-horizontal-test.js b/tests/specs/mouse-controls/range-slider-horizontal-test.js index b961873..e5918b4 100644 --- a/tests/specs/mouse-controls/range-slider-horizontal-test.js +++ b/tests/specs/mouse-controls/range-slider-horizontal-test.js @@ -110,9 +110,8 @@ sinon.spy(helper.slider, 'positionTrackingHandle'); sinon.spy(helper.slider, 'callOnChange'); var event = helper.fireMousedown(helper.slider.minH, 0); - var expectedValue = 50, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 50; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.min).to.equal(expectedValue); helper.slider.positionTrackingHandle.called.should.be.true; helper.slider.callOnChange.called.should.be.true; @@ -122,9 +121,8 @@ sinon.spy(helper.slider, 'positionTrackingHandle'); sinon.spy(helper.slider, 'callOnChange'); helper.fireMousedown(helper.slider.maxH, 0); - var expectedValue = 50, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 50; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.max).to.equal(expectedValue); helper.slider.positionTrackingHandle.called.should.be.true; helper.slider.callOnChange.called.should.be.true; @@ -137,9 +135,8 @@ sinon.spy(helper.slider, 'focusElement'); helper.fireMousedown(helper.slider.minH, 0); - var expectedValue = 80, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 80; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.min).to.equal(60); expect(helper.scope.slider.max).to.equal(80); @@ -154,9 +151,8 @@ sinon.spy(helper.slider, 'focusElement'); helper.fireMousedown(helper.slider.minH, 0); - var expectedValue = 80, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 80; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.min).to.equal(60); expect(helper.scope.slider.max).to.equal(80); @@ -170,9 +166,8 @@ sinon.spy(helper.slider, 'focusElement'); helper.fireMousedown(helper.slider.maxH, 0); - var expectedValue = 20, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 20; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.min).to.equal(20); expect(helper.scope.slider.max).to.equal(40); @@ -187,9 +182,8 @@ sinon.spy(helper.slider, 'focusElement'); helper.fireMousedown(helper.slider.maxH, 0); - var expectedValue = 20, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 20; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.min).to.equal(20); expect(helper.scope.slider.max).to.equal(40); @@ -203,7 +197,7 @@ sinon.spy(helper.slider, 'focusElement'); var expectedValue = 10, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; + offset = helper.getMousePosition(expectedValue); var event = helper.fireMousedown(helper.slider.fullBar, offset); @@ -222,7 +216,7 @@ sinon.spy(helper.slider, 'focusElement'); var expectedValue = 90, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; + offset = helper.getMousePosition(expectedValue); var event = helper.fireMousedown(helper.slider.fullBar, offset); @@ -241,7 +235,7 @@ sinon.spy(helper.slider, 'focusElement'); var expectedValue = 10, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; + offset = helper.getMousePosition(expectedValue); var event = helper.fireMousedown(helper.slider.selBar, offset); @@ -260,7 +254,7 @@ sinon.spy(helper.slider, 'focusElement'); var expectedValue = 90, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; + offset = helper.getMousePosition(expectedValue); var event = helper.fireMousedown(helper.slider.selBar, offset); @@ -383,9 +377,8 @@ sinon.spy(helper.slider, 'positionTrackingHandle'); sinon.spy(helper.slider, 'callOnChange'); var event = helper.fireMousedown(helper.slider.minH, 0); - var expectedValue = 50, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 50; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.min).to.equal(expectedValue); helper.slider.positionTrackingHandle.called.should.be.true; helper.slider.callOnChange.called.should.be.true; @@ -395,9 +388,8 @@ sinon.spy(helper.slider, 'positionTrackingHandle'); sinon.spy(helper.slider, 'callOnChange'); helper.fireMousedown(helper.slider.maxH, 0); - var expectedValue = 50, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 50; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.max).to.equal(expectedValue); helper.slider.positionTrackingHandle.called.should.be.true; helper.slider.callOnChange.called.should.be.true; @@ -410,9 +402,8 @@ sinon.spy(helper.slider, 'focusElement'); helper.fireMousedown(helper.slider.minH, 0); - var expectedValue = 80, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 80; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.min).to.equal(60); expect(helper.scope.slider.max).to.equal(80); @@ -427,9 +418,8 @@ sinon.spy(helper.slider, 'focusElement'); helper.fireMousedown(helper.slider.minH, 0); - var expectedValue = 80, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 80; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.min).to.equal(60); expect(helper.scope.slider.max).to.equal(80); @@ -443,9 +433,8 @@ sinon.spy(helper.slider, 'focusElement'); helper.fireMousedown(helper.slider.maxH, 0); - var expectedValue = 20, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 20; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.min).to.equal(20); expect(helper.scope.slider.max).to.equal(40); @@ -460,9 +449,8 @@ sinon.spy(helper.slider, 'focusElement'); helper.fireMousedown(helper.slider.maxH, 0); - var expectedValue = 20, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; - helper.fireMousemove(offset); + var expectedValue = 20; + helper.moveMouseToValue(expectedValue); expect(helper.scope.slider.min).to.equal(20); expect(helper.scope.slider.max).to.equal(40); @@ -476,7 +464,7 @@ sinon.spy(helper.slider, 'focusElement'); var expectedValue = 10, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; + offset = helper.getMousePosition(expectedValue); var event = helper.fireMousedown(helper.slider.fullBar, offset); @@ -495,7 +483,7 @@ sinon.spy(helper.slider, 'focusElement'); var expectedValue = 90, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; + offset = helper.getMousePosition(expectedValue); var event = helper.fireMousedown(helper.slider.fullBar, offset); @@ -514,7 +502,7 @@ sinon.spy(helper.slider, 'focusElement'); var expectedValue = 10, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; + offset = helper.getMousePosition(expectedValue); var event = helper.fireMousedown(helper.slider.selBar, offset); @@ -533,7 +521,7 @@ sinon.spy(helper.slider, 'focusElement'); var expectedValue = 90, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; + offset = helper.getMousePosition(expectedValue); var event = helper.fireMousedown(helper.slider.selBar, offset); diff --git a/tests/specs/mouse-controls/single-slider-horizontal-test.js b/tests/specs/mouse-controls/single-slider-horizontal-test.js index bb9f136..db774a8 100644 --- a/tests/specs/mouse-controls/single-slider-horizontal-test.js +++ b/tests/specs/mouse-controls/single-slider-horizontal-test.js @@ -75,7 +75,7 @@ sinon.spy(helper.slider, 'callOnChange'); var event = helper.fireMousedown(helper.slider.minH, 0); var expectedValue = 50, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; + offset = helper.getMousePosition(expectedValue); helper.fireMousemove(offset); expect(helper.scope.slider.value).to.equal(expectedValue); helper.slider.positionTrackingHandle.called.should.be.true; @@ -136,7 +136,7 @@ sinon.spy(helper.slider, 'callOnChange'); var expectedValue = 12, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; + offset = helper.getMousePosition(expectedValue); helper.fireMousedown(helper.slider.fullBar, offset); @@ -153,7 +153,7 @@ sinon.spy(helper.slider, 'callOnChange'); var expectedValue = 12, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; + offset = helper.getMousePosition(expectedValue); var event = helper.fireMousedown(helper.slider.selBar, offset); @@ -173,7 +173,7 @@ sinon.spy(helper.slider, 'callOnChange'); var expectedValue = 10, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; + offset = helper.getMousePosition(expectedValue); helper.fireMousedown(helper.slider.ticks, offset); @@ -193,7 +193,7 @@ sinon.spy(helper.slider, 'callOnChange'); var expectedValue = 10, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; + offset = helper.getMousePosition(expectedValue); helper.fireMousedown(helper.slider.ticks, offset); @@ -280,7 +280,7 @@ sinon.spy(helper.slider, 'callOnChange'); var event = helper.fireMousedown(helper.slider.minH, 0); var expectedValue = 50, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; + offset = helper.getMousePosition(expectedValue); helper.fireMousemove(offset); expect(helper.scope.slider.value).to.equal(expectedValue); helper.slider.positionTrackingHandle.called.should.be.true; @@ -340,7 +340,7 @@ sinon.spy(helper.slider, 'callOnChange'); var expectedValue = 12, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; + offset = helper.getMousePosition(expectedValue); helper.fireMousedown(helper.slider.fullBar, offset); @@ -357,7 +357,7 @@ sinon.spy(helper.slider, 'callOnChange'); var expectedValue = 12, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; + offset = helper.getMousePosition(expectedValue); var event = helper.fireMousedown(helper.slider.selBar, offset); @@ -377,7 +377,7 @@ sinon.spy(helper.slider, 'callOnChange'); var expectedValue = 10, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; + offset = helper.getMousePosition(expectedValue); helper.fireMousedown(helper.slider.ticks, offset); @@ -397,7 +397,7 @@ sinon.spy(helper.slider, 'callOnChange'); var expectedValue = 10, - offset = helper.slider.valueToOffset(expectedValue) + helper.slider.handleHalfDim + helper.slider.sliderElem.rzsp; + offset = helper.getMousePosition(expectedValue); helper.fireMousedown(helper.slider.ticks, offset);