Skip to content

Commit 4f54f62

Browse files
committed
drop rangeslider style attributes to editType: plot and test
1 parent 95b8c10 commit 4f54f62

File tree

2 files changed

+22
-14
lines changed

2 files changed

+22
-14
lines changed

src/components/rangeslider/attributes.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,22 @@ module.exports = {
1515
valType: 'color',
1616
dflt: colorAttributes.background,
1717
role: 'style',
18-
editType: 'calc',
18+
editType: 'plot',
1919
description: 'Sets the background color of the range slider.'
2020
},
2121
bordercolor: {
2222
valType: 'color',
2323
dflt: colorAttributes.defaultLine,
2424
role: 'style',
25-
editType: 'calc',
25+
editType: 'plot',
2626
description: 'Sets the border color of the range slider.'
2727
},
2828
borderwidth: {
2929
valType: 'integer',
3030
dflt: 0,
3131
min: 0,
3232
role: 'style',
33-
editType: 'calc',
33+
editType: 'plot',
3434
description: 'Sets the border color of the range slider.'
3535
},
3636
autorange: {
@@ -73,7 +73,7 @@ module.exports = {
7373
min: 0,
7474
max: 1,
7575
role: 'style',
76-
editType: 'calc',
76+
editType: 'plot',
7777
description: [
7878
'The height of the range slider as a fraction of the',
7979
'total plot area height.'

test/jasmine/tests/range_slider_test.js

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ describe('Visible rangesliders', function() {
6565
.then(done);
6666
});
6767

68-
it('should have the correct width and height', function(done) {
68+
it('should have the correct style and size and be able to update these', function(done) {
6969
plotMock().then(function() {
7070
var bg = getRangeSliderChild(0);
7171

@@ -75,18 +75,26 @@ describe('Visible rangesliders', function() {
7575
// width incorporates border widths
7676
expect(+bg.getAttribute('width')).toEqual(expectedWidth);
7777
expect(+bg.getAttribute('height')).toEqual(66);
78-
})
79-
.catch(failTest)
80-
.then(done);
81-
});
82-
83-
it('should have the correct style', function(done) {
84-
plotMock().then(function() {
85-
var bg = getRangeSliderChild(0);
8678

8779
expect(bg.getAttribute('fill')).toBe('#fafafa');
8880
expect(bg.getAttribute('stroke')).toBe('black');
89-
expect(bg.getAttribute('stroke-width')).toBe('2');
81+
expect(+bg.getAttribute('stroke-width')).toBe(2);
82+
83+
return Plotly.relayout(gd, {
84+
'xaxis.rangeslider.thickness': 0.1,
85+
'xaxis.rangeslider.bgcolor': '#ffff80',
86+
'xaxis.rangeslider.bordercolor': '#404040',
87+
'xaxis.rangeslider.borderwidth': 1
88+
});
89+
})
90+
.then(function() {
91+
var bg = getRangeSliderChild(0);
92+
93+
expect(+bg.getAttribute('height')).toEqual(32);
94+
95+
expect(bg.getAttribute('fill')).toBe('#ffff80');
96+
expect(bg.getAttribute('stroke')).toBe('#404040');
97+
expect(+bg.getAttribute('stroke-width')).toBe(1);
9098
})
9199
.catch(failTest)
92100
.then(done);

0 commit comments

Comments
 (0)