Skip to content

Commit e97a80e

Browse files
committed
add range slider visible: false supply-default test
1 parent 95817e8 commit e97a80e

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/components/rangeslider/defaults.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ var isNumeric = require('fast-isnumeric');
1313
var Lib = require('../../lib');
1414
var attributes = require('./attributes');
1515

16-
1716
module.exports = function handleDefaults(layoutIn, layoutOut, axName) {
1817
if(!layoutIn[axName].rangeslider) return;
1918

@@ -30,6 +29,9 @@ module.exports = function handleDefaults(layoutIn, layoutOut, axName) {
3029
return Lib.coerce(containerIn, containerOut, attributes, attr, dflt);
3130
}
3231

32+
var visible = coerce('visible');
33+
if(!visible) return;
34+
3335
coerce('bgcolor', layoutOut.plot_bgcolor);
3436
coerce('bordercolor');
3537
coerce('borderwidth');
@@ -40,7 +42,6 @@ module.exports = function handleDefaults(layoutIn, layoutOut, axName) {
4042
isNumeric(axOut.r2l(containerIn.range[0])) &&
4143
isNumeric(axOut.r2l(containerIn.range[1]))
4244
));
43-
coerce('visible');
4445
coerce('range');
4546

4647
// Expand slider range to the axis range

test/jasmine/tests/range_slider_test.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,14 @@ describe('the range slider', function() {
393393

394394
_supply(layoutIn, layoutOut, 'xaxis');
395395
expect(layoutOut.xaxis.rangeslider).toEqual(expected);
396+
});
397+
398+
it('should return early if *visible: false*', function() {
399+
var layoutIn = { xaxis: { rangeslider: { visible: false, range: [10, 20] }} },
400+
layoutOut = { xaxis: { rangeslider: {}} };
396401

402+
_supply(layoutIn, layoutOut, 'xaxis');
403+
expect(layoutOut.xaxis.rangeslider).toEqual({ visible: false });
397404
});
398405

399406
it('should set defaults if properties are invalid', function() {

0 commit comments

Comments
 (0)