Skip to content

Commit decec45

Browse files
committed
scattergl: 🔒 down handling of texttemplate with fewer elements than data
1 parent b9188a9 commit decec45

File tree

3 files changed

+16
-13
lines changed

3 files changed

+16
-13
lines changed

Diff for: test/image/baselines/gl2d_texttemplate.png

693 Bytes
Loading

Diff for: test/image/mocks/gl2d_texttemplate.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"mode": "markers+text",
1616
"x": [3, 2, 1, 0],
1717
"y": [0, 1, 4, 9],
18-
"text": ["1", "2", "3"],
18+
"texttemplate": ["1", "2", "3"],
1919
"textposition": "top center",
2020
"xaxis": "x2",
2121
"yaxis": "y2"

Diff for: test/jasmine/tests/scattergl_test.js

+15-12
Original file line numberDiff line numberDiff line change
@@ -117,18 +117,21 @@ describe('end-to-end scattergl tests', function() {
117117
}).catch(failTest).then(done);
118118
});
119119

120-
it('@gl should handle a plot with less text labels than data points', function(done) {
121-
expect(function() {
122-
Plotly.plot(gd, [{
123-
'type': 'scattergl',
124-
'mode': 'markers+text',
125-
'x': [3, 2, 1, 0],
126-
'y': [0, 1, 4, 9],
127-
'text': ['1', '2', '3'],
128-
'textposition': 'top center'
129-
}]);
130-
}).not.toThrow();
131-
done();
120+
['text', 'texttemplate'].forEach(function(attr) {
121+
it('@gl should handle a plot with less ' + attr + ' labels than data points', function(done) {
122+
expect(function() {
123+
var mock = {
124+
'type': 'scattergl',
125+
'mode': 'markers+text',
126+
'x': [3, 2, 1, 0],
127+
'y': [0, 1, 4, 9],
128+
'textposition': 'top center'
129+
};
130+
mock[attr] = ['1', '2', '3'];
131+
Plotly.plot(gd, [mock]);
132+
}).not.toThrow();
133+
done();
134+
});
132135
});
133136

134137
it('@gl should be able to toggle visibility', function(done) {

0 commit comments

Comments
 (0)