Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fd659f2

Browse files
committed
add test case for image relayout in { astr: val }
1 parent 6a08dfa commit fd659f2

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

test/jasmine/tests/layout_images_test.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,22 @@ describe('Layout images', function() {
260260
}).then(done);
261261
});
262262

263+
it('should update the image position if changed', function(done) {
264+
var update = {
265+
'images[0].x': 0,
266+
'images[0].y': 1
267+
};
268+
269+
var img = Plotly.d3.select('image');
270+
271+
expect([+img.attr('x'), +img.attr('y')]).toEqual([1160, -170]);
272+
273+
Plotly.relayout(gd, update).then(function() {
274+
var newImg = Plotly.d3.select('image');
275+
expect([+newImg.attr('x'), +newImg.attr('y')]).toEqual([80, 100]);
276+
}).then(done);
277+
});
278+
263279
it('should remove the image tag if an invalid source', function(done) {
264280

265281
var selection = Plotly.d3.select('image');

0 commit comments

Comments
 (0)