Skip to content

Commit 33a2f16

Browse files
committed
add tests
1 parent bb4a1f7 commit 33a2f16

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

test/jasmine/tests/animate_test.js

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -708,6 +708,56 @@ describe('Animate API details', function() {
708708
});
709709
});
710710

711+
describe('Animate expandObjectPaths do not pollute prototype', function() {
712+
'use strict';
713+
714+
var gd;
715+
716+
beforeEach(function() {
717+
gd = createGraphDiv();
718+
});
719+
720+
afterEach(function() {
721+
Plotly.purge(gd);
722+
destroyGraphDiv();
723+
});
724+
725+
it('should not pollute prototype - layout object', function(done) {
726+
Plotly.newPlot(gd, {
727+
data: [{y: [1, 3, 2]}]
728+
}).then(function() {
729+
return Plotly.animate(gd, {
730+
transition: {duration: 10},
731+
data: [{y: [2, 3, 1]}],
732+
traces: [0],
733+
layout: {'__proto__.polluted': true}
734+
});
735+
}).then(function() {
736+
setTimeout(function() {
737+
var a = {};
738+
expect(a.polluted).toBeUndefined();
739+
}, 100);
740+
}).then(done, done.fail);
741+
});
742+
743+
it('should not pollute prototype - data object', function(done) {
744+
Plotly.newPlot(gd, {
745+
data: [{y: [1, 3, 2]}]
746+
}).then(function() {
747+
return Plotly.animate(gd, {
748+
transition: {duration: 10},
749+
data: [{y: [2, 3, 1], '__proto__.polluted': true}],
750+
traces: [0]
751+
});
752+
}).then(function() {
753+
setTimeout(function() {
754+
var a = {};
755+
expect(a.polluted).toBeUndefined();
756+
}, 100);
757+
}).then(done, done.fail);
758+
});
759+
});
760+
711761
describe('Animating multiple axes', function() {
712762
var gd;
713763

0 commit comments

Comments
 (0)