Skip to content

Commit ecd795a

Browse files
committed
test: add case for addTraces with exising data/traces
1 parent fa18648 commit ecd795a

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/jasmine/tests/plot_api_test.js

+14
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,21 @@ describe('Test plot api', function() {
474474
expect(gd.data[2].uid).toBeDefined();
475475
expect(PlotlyInternal.redraw).not.toHaveBeenCalled();
476476
expect(PlotlyInternal.moveTraces).toHaveBeenCalledWith(gd, [-1], [0]);
477+
});
478+
479+
it('should work when adding an existing trace', function() {
480+
Plotly.addTraces(gd, gd.data[0]);
481+
482+
expect(gd.data.length).toEqual(3);
483+
expect(gd.data[0]).not.toBe(gd.data[2]);
484+
});
485+
486+
it('should work when duplicating the existing data', function() {
487+
Plotly.addTraces(gd, gd.data);
477488

489+
expect(gd.data.length).toEqual(4)
490+
expect(gd.data[0]).not.toBe(gd.data[2]);
491+
expect(gd.data[1]).not.toBe(gd.data[3]);
478492
});
479493
});
480494

0 commit comments

Comments
 (0)