Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
vidjil
vidjil
Commits
6fbf98f1
Commit
6fbf98f1
authored
Aug 08, 2018
by
Mathieu Giraud
Browse files
js/tools.js, tests: nice_min_max_step() yield no step when min = max
parent
7c7e3f84
Changes
2
Hide whitespace changes
Inline
Side-by-side
browser/js/tools.js
View file @
6fbf98f1
...
...
@@ -369,6 +369,9 @@ function nice_floor(x, force_pow10)
function
nice_min_max_steps
(
min
,
max
,
nb_max_steps
)
{
if
(
min
==
max
)
return
{
min
:
min
,
max
:
max
,
step
:
0
,
nb_steps
:
0
}
var
basic_step
=
nice_1_2_5_ceil
((
max
-
min
)
/
nb_max_steps
)
var
n_min
=
nice_floor
(
min
,
basic_step
)
...
...
browser/test/QUnit/testFiles/tools_test.js
View file @
6fbf98f1
...
...
@@ -72,6 +72,8 @@ QUnit.test("test nice_min_max_steps", function(assert) {
assert
.
deepEqual
(
nice_min_max_steps
(
43
,
103
,
5
),
{
min
:
40
,
max
:
120
,
step
:
20
,
nb_steps
:
4
},
"
43..103 (5)
"
);
assert
.
deepEqual
(
nice_min_max_steps
(
43
,
103
,
3
),
{
min
:
0
,
max
:
150
,
step
:
50
,
nb_steps
:
3
},
"
43..103 (3)
"
);
assert
.
deepEqual
(
nice_min_max_steps
(
42
,
42
,
20
),
{
min
:
42
,
max
:
42
,
step
:
0
,
nb_steps
:
0
},
"
42..42 (20)
"
);
});
QUnit
.
test
(
"
prepend_path_if_not_web
"
,
function
(
assert
)
{
...
...
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