Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
I
i20rzslider
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jedife
i20rzslider
Commits
3a6b103d
Commit
3a6b103d
authored
Jul 02, 2016
by
Valentin Hervieu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore(tests): Add a moveMouseToValue helper to simplofy many tests
parent
12f3e012
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
175 additions
and
235 deletions
+175
-235
helper.js
tests/specs/helper.js
+6
-3
draggable-range-slider-horizontal-test.js
.../mouse-controls/draggable-range-slider-horizontal-test.js
+16
-20
minMaxLimit-range-slider-horizontal-test.js
...ouse-controls/minMaxLimit-range-slider-horizontal-test.js
+16
-24
minMaxLimit-single-slider-horizontal-test.js
...use-controls/minMaxLimit-single-slider-horizontal-test.js
+16
-24
minMaxRange-noSwitching-range-slider-horizontal-test.js
...s/minMaxRange-noSwitching-range-slider-horizontal-test.js
+21
-30
minMaxRange-range-slider-horizontal-test.js
...ouse-controls/minMaxRange-range-slider-horizontal-test.js
+32
-48
noSwitching-range-slider-horizontal-test.js
...ouse-controls/noSwitching-range-slider-horizontal-test.js
+12
-16
onlyBindHandles-single-slider-horizontal-test.js
...controls/onlyBindHandles-single-slider-horizontal-test.js
+4
-6
pushRange-range-slider-horizontal-test.js
.../mouse-controls/pushRange-range-slider-horizontal-test.js
+10
-10
range-slider-horizontal-test.js
tests/specs/mouse-controls/range-slider-horizontal-test.js
+32
-44
single-slider-horizontal-test.js
tests/specs/mouse-controls/single-slider-horizontal-test.js
+10
-10
No files found.
tests/specs/helper.js
View file @
3a6b103d
...
...
@@ -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
;
...
...
tests/specs/mouse-controls/draggable-range-slider-horizontal-test.js
View file @
3a6b103d
...
...
@@ -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
);
...
...
tests/specs/mouse-controls/minMaxLimit-range-slider-horizontal-test.js
View file @
3a6b103d
...
...
@@ -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
);
});
});
...
...
tests/specs/mouse-controls/minMaxLimit-single-slider-horizontal-test.js
View file @
3a6b103d
...
...
@@ -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
);
});
});
...
...
tests/specs/mouse-controls/minMaxRange-noSwitching-range-slider-horizontal-test.js
View file @
3a6b103d
...
...
@@ -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
);
});
...
...
tests/specs/mouse-controls/minMaxRange-range-slider-horizontal-test.js
View file @
3a6b103d
...
...
@@ -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
);
});
...
...
tests/specs/mouse-controls/noSwitching-range-slider-horizontal-test.js
View file @
3a6b103d
...
...
@@ -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
);
...
...
tests/specs/mouse-controls/onlyBindHandles-single-slider-horizontal-test.js
View file @
3a6b103d
...
...
@@ -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
;
...
...
tests/specs/mouse-controls/pushRange-range-slider-horizontal-test.js
View file @
3a6b103d
...
...
@@ -39,28 +39,28 @@
it
(
'should push maxH when moving minH above it'
,
function
()
{
helper
.
fireMousedown
(
helper
.
slider
.
minH
,
0
);
helper
.
mo
useMov
eToValue
(
60
);
helper
.
mo
veMous
eToValue
(
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
.
mo
useMov
eToValue
(
40
);
helper
.
mo
veMous
eToValue
(
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
.
mo
useMov
eToValue
(
100
);
helper
.
mo
veMous
eToValue
(
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
.
mo
useMov
eToValue
(
0
);
helper
.
mo
veMous
eToValue
(
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
.
mo
useMov
eToValue
(
60
);
helper
.
mo
veMous
eToValue
(
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
.
mo
useMov
eToValue
(
40
);
helper
.
mo
veMous
eToValue
(
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
.
mo
useMov
eToValue
(
60
);
helper
.
mo
veMous
eToValue
(
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
.
mo
useMov
eToValue
(
40
);
helper
.
mo
veMous
eToValue
(
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
.
mo
useMov
eToValue
(
60
);
helper
.
mo
veMous
eToValue
(
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
.
mo
useMov
eToValue
(
40
);
helper
.
mo
veMous
eToValue
(
40
);
expect
(
helper
.
scope
.
slider
.
min
).
to
.
equal
(
40
);
expect
(
helper
.
scope
.
slider
.
max
).
to
.
equal
(
40
);
});
...
...
tests/specs/mouse-controls/range-slider-horizontal-test.js
View file @
3a6b103d
...
...
@@ -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
);
...
...
tests/specs/mouse-controls/single-slider-horizontal-test.js
View file @
3a6b103d
...
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment