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
d0a5b769
Commit
d0a5b769
authored
Jan 22, 2016
by
Valentin Hervieu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test(minRange): Add test coverage for minRange option
parent
1e5a483c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
598 additions
and
514 deletions
+598
-514
rz-slider-service-test.js
tests/spec/rz-slider-service-test.js
+598
-514
No files found.
tests/spec/rz-slider-service-test.js
View file @
d0a5b769
...
@@ -2120,7 +2120,6 @@ describe('rzslider - ', function() {
...
@@ -2120,7 +2120,6 @@ describe('rzslider - ', function() {
slider
.
callOnChange
.
called
.
should
.
be
.
true
;
slider
.
callOnChange
.
called
.
should
.
be
.
true
;
});
});
});
});
});
describe
(
'range vertical slider - '
,
function
()
{
describe
(
'range vertical slider - '
,
function
()
{
beforeEach
(
function
()
{
beforeEach
(
function
()
{
...
@@ -2652,7 +2651,7 @@ describe('rzslider - ', function() {
...
@@ -2652,7 +2651,7 @@ describe('rzslider - ', function() {
});
});
});
});
describe
(
'single horizontal slider
- '
,
function
()
{
describe
(
'single horizontal slider with onlyBindHandles
- '
,
function
()
{
beforeEach
(
function
()
{
beforeEach
(
function
()
{
var
sliderConf
=
{
var
sliderConf
=
{
value
:
0
,
value
:
0
,
...
@@ -2696,6 +2695,59 @@ describe('rzslider - ', function() {
...
@@ -2696,6 +2695,59 @@ describe('rzslider - ', function() {
});
});
});
});
describe
(
'single horizontal slider with onlyBindHandles - '
,
function
()
{
beforeEach
(
function
()
{
var
sliderConf
=
{
min
:
45
,
max
:
55
,
options
:
{
floor
:
0
,
ceil
:
100
,
minRange
:
10
}
};
createRangeSlider
(
sliderConf
);
});
afterEach
(
function
()
{
// to clean document listener
fireMouseup
();
});
it
(
'should not modify any value if new range would be smaller than minRange when moving minH'
,
function
()
{
fireMousedown
(
slider
.
minH
,
0
);
var
expectedValue
=
50
,
offset
=
slider
.
valueToOffset
(
expectedValue
)
+
slider
.
handleHalfDim
+
slider
.
sliderElem
.
rzsp
;
fireMousemove
(
offset
);
expect
(
scope
.
slider
.
min
).
to
.
equal
(
45
);
});
it
(
'should not modify any value if new range would be smaller than minRange when moving maxH'
,
function
()
{
fireMousedown
(
slider
.
maxH
,
0
);
var
expectedValue
=
50
,
offset
=
slider
.
valueToOffset
(
expectedValue
)
+
slider
.
handleHalfDim
+
slider
.
sliderElem
.
rzsp
;
fireMousemove
(
offset
);
expect
(
scope
.
slider
.
max
).
to
.
equal
(
55
);
});
it
(
'should modify the min value if new range is larger than minRange when moving minH'
,
function
()
{
fireMousedown
(
slider
.
minH
,
0
);
var
expectedValue
=
30
,
offset
=
slider
.
valueToOffset
(
expectedValue
)
+
slider
.
handleHalfDim
+
slider
.
sliderElem
.
rzsp
;
fireMousemove
(
offset
);
expect
(
scope
.
slider
.
min
).
to
.
equal
(
expectedValue
);
});
it
(
'should modify the max value if new range is larger than than minRange when moving maxH'
,
function
()
{
fireMousedown
(
slider
.
maxH
,
0
);
var
expectedValue
=
70
,
offset
=
slider
.
valueToOffset
(
expectedValue
)
+
slider
.
handleHalfDim
+
slider
.
sliderElem
.
rzsp
;
fireMousemove
(
offset
);
expect
(
scope
.
slider
.
max
).
to
.
equal
(
expectedValue
);
});
});
});
/*
/*
******************************************************************************
******************************************************************************
KEYBOARD CONTROLS
KEYBOARD CONTROLS
...
@@ -3114,19 +3166,51 @@ describe('rzslider - ', function() {
...
@@ -3114,19 +3166,51 @@ describe('rzslider - ', function() {
expect
(
scope
.
slider
.
value
).
to
.
equal
(
10
);
expect
(
scope
.
slider
.
value
).
to
.
equal
(
10
);
});
});
it
(
'should not be modified by keyboard if
keyboardSupport=fals
e'
,
function
()
{
it
(
'should not be modified by keyboard if
new range is below minRang
e'
,
function
()
{
var
sliderConf
=
{
var
sliderConf
=
{
value
:
10
,
min
:
45
,
max
:
55
,
options
:
{
options
:
{
floor
:
0
,
floor
:
0
,
ceil
:
100
,
ceil
:
100
,
keyboardSupport
:
false
step
:
1
,
minRange
:
10
}
}
};
};
createSlider
(
sliderConf
);
createRangeSlider
(
sliderConf
);
//try to move minH right
slider
.
minH
.
triggerHandler
(
'focus'
);
pressKeydown
(
slider
.
minH
,
'RIGHT'
);
expect
(
scope
.
slider
.
min
).
to
.
equal
(
45
);
//try to move maxH left
slider
.
maxH
.
triggerHandler
(
'focus'
);
pressKeydown
(
slider
.
maxH
,
'LEFT'
);
expect
(
scope
.
slider
.
max
).
to
.
equal
(
55
);
});
it
(
'should be modified by keyboard if new range is above minRange'
,
function
()
{
var
sliderConf
=
{
min
:
45
,
max
:
55
,
options
:
{
floor
:
0
,
ceil
:
100
,
step
:
1
,
minRange
:
10
}
};
createRangeSlider
(
sliderConf
);
//try to move minH left
slider
.
minH
.
triggerHandler
(
'focus'
);
slider
.
minH
.
triggerHandler
(
'focus'
);
pressKeydown
(
slider
.
minH
,
'LEFT'
);
pressKeydown
(
slider
.
minH
,
'LEFT'
);
expect
(
scope
.
slider
.
value
).
to
.
equal
(
10
);
expect
(
scope
.
slider
.
min
).
to
.
equal
(
44
);
//try to move maxH right
slider
.
maxH
.
triggerHandler
(
'focus'
);
pressKeydown
(
slider
.
maxH
,
'RIGHT'
);
expect
(
scope
.
slider
.
max
).
to
.
equal
(
56
);
});
});
});
});
...
...
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