Skip to content

Commit e2a9c6e

Browse files
committed
image: 🔒 down that x0 and y0 can be restyled to/from category
1 parent 0eb6604 commit e2a9c6e

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

test/jasmine/tests/image_test.js

+22
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,28 @@ describe('image plot', function() {
218218
.then(done);
219219
});
220220

221+
it('should handle restyling x0/y0 to category', function(done) {
222+
var mock = require('@mocks/image_opacity.json');
223+
var mockCopy = Lib.extendDeep({}, mock);
224+
225+
var x = []; var y = [];
226+
Plotly.newPlot(gd, mockCopy).then(function() {
227+
return Plotly.restyle(gd, {x0: 50, y0: 50});
228+
}).then(function() {
229+
x.push(d3.select(sel).attr('x'));
230+
y.push(d3.select(sel).attr('y'));
231+
232+
return Plotly.restyle(gd, {x0: 'A', y0: 'F'});
233+
}).then(function() {
234+
x.push(d3.select(sel).attr('x'));
235+
y.push(d3.select(sel).attr('y'));
236+
expect(x[1]).toEqual(x[0], 'image element should have same x position');
237+
expect(y[1]).toEqual(y[0], 'image element should have same y position');
238+
})
239+
.catch(failTest)
240+
.then(done);
241+
});
242+
221243
it('keeps the correct ordering after hide and show', function(done) {
222244
function getIndices() {
223245
var out = [];

0 commit comments

Comments
 (0)