Skip to content

Commit 71998dd

Browse files
committed
RangeSlider: Add test for relayout updates
1 parent e8382d9 commit 71998dd

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/jasmine/tests/range_slider_test.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,25 @@ describe('the range slider', function() {
137137
expect(rangeDiff3).toBeLessThan(rangeDiff2);
138138
}).then(done);
139139
});
140+
141+
it('should relayout with relayout "array syntax"', function(done) {
142+
Plotly.relayout(gd, 'xaxis.range', [10, 20])
143+
.then(function() {
144+
expect(gd._fullLayout.xaxis.range).toEqual([10, 20]);
145+
expect(+rangeSlider.getAttribute('data-min')).toBeCloseTo(125.51, 0);
146+
expect(+rangeSlider.getAttribute('data-max')).toBeCloseTo(251.02, 0);
147+
})
148+
.then(done);
149+
});
150+
151+
it('should relayout with relayout "element syntax"', function(done) {
152+
Plotly.relayout(gd, 'xaxis.range[0]', 10)
153+
.then(function() {
154+
expect(gd._fullLayout.xaxis.range[0]).toEqual(10);
155+
expect(+rangeSlider.getAttribute('data-min')).toBeCloseTo(125.51, 0);
156+
})
157+
.then(done);
158+
});
140159
});
141160

142161

0 commit comments

Comments
 (0)