Skip to content

Commit 063784a

Browse files
committed
test switching to circular Sankey on Plotly.react
1 parent ba2a485 commit 063784a

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

test/jasmine/tests/sankey_test.js

+41
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,47 @@ describe('sankey tests', function() {
360360
done();
361361
});
362362
});
363+
364+
it('switch from normal to circular Sankey on react', function(done) {
365+
var gd = createGraphDiv();
366+
var mockCopy = Lib.extendDeep({}, mock);
367+
var mockCircularCopy = Lib.extendDeep({}, mockCircular);
368+
369+
Plotly.plot(gd, mockCopy)
370+
.then(function() {
371+
expect(gd.calcdata[0][0].circular).toBe(false);
372+
return Plotly.react(gd, mockCircularCopy);
373+
})
374+
.then(function() {
375+
expect(gd.calcdata[0][0].circular).toBe(true);
376+
done();
377+
});
378+
});
379+
380+
it('switch from circular to normal Sankey on react', function(done) {
381+
var gd = createGraphDiv();
382+
var mockCircularCopy = Lib.extendDeep({}, mockCircular);
383+
384+
Plotly.plot(gd, mockCircularCopy)
385+
.then(function() {
386+
expect(gd.calcdata[0][0].circular).toBe(true);
387+
388+
// Remove circular links
389+
var source = mockCircularCopy.data[0].link.source;
390+
source.splice(6, 1);
391+
source.splice(4, 1);
392+
393+
var target = mockCircularCopy.data[0].link.target;
394+
target.splice(6, 1);
395+
target.splice(4, 1);
396+
397+
return Plotly.react(gd, mockCircularCopy);
398+
})
399+
.then(function() {
400+
expect(gd.calcdata[0][0].circular).toBe(false);
401+
done();
402+
});
403+
});
363404
});
364405

365406
describe('Test hover/click interactions:', function() {

0 commit comments

Comments
 (0)