Skip to content

Commit 040ed1b

Browse files
committed
test colorbar editing
1 parent 87b26d5 commit 040ed1b

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

test/jasmine/tests/plot_api_test.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,6 +1142,46 @@ describe('Test plot api', function() {
11421142
.catch(fail)
11431143
.then(done);
11441144
});
1145+
1146+
it('updates colorbars when editing bar charts', function(done) {
1147+
var mock = require('@mocks/bar-colorbar-colorscale.json');
1148+
1149+
Plotly.newPlot(gd, mock.data, mock.layout)
1150+
.then(function() {
1151+
expect(d3.select('.cbaxis text').style('fill')).not.toBe('rgb(255, 0, 0)');
1152+
1153+
return Plotly.restyle(gd, {'marker.colorbar.tickfont.color': 'rgb(255, 0, 0)'});
1154+
})
1155+
.then(function() {
1156+
expect(d3.select('.cbaxis text').style('fill')).toBe('rgb(255, 0, 0)');
1157+
1158+
return Plotly.restyle(gd, {'marker.showscale': false});
1159+
})
1160+
.then(function() {
1161+
expect(d3.select('.cbaxis').size()).toBe(0);
1162+
})
1163+
.catch(fail)
1164+
.then(done);
1165+
});
1166+
1167+
it('updates colorbars when editing gl3d plots', function(done) {
1168+
Plotly.newPlot(gd, [{z: [[1, 2], [3, 6]], type: 'surface'}])
1169+
.then(function() {
1170+
expect(d3.select('.cbaxis text').style('fill')).not.toBe('rgb(255, 0, 0)');
1171+
1172+
return Plotly.restyle(gd, {'colorbar.tickfont.color': 'rgb(255, 0, 0)'});
1173+
})
1174+
.then(function() {
1175+
expect(d3.select('.cbaxis text').style('fill')).toBe('rgb(255, 0, 0)');
1176+
1177+
return Plotly.restyle(gd, {'showscale': false});
1178+
})
1179+
.then(function() {
1180+
expect(d3.select('.cbaxis').size()).toBe(0);
1181+
})
1182+
.catch(fail)
1183+
.then(done);
1184+
});
11451185
});
11461186

11471187
describe('Plotly.deleteTraces', function() {

0 commit comments

Comments
 (0)