Skip to content

Commit d1547ee

Browse files
committed
Sync tests from upstream master
1 parent 3662eb5 commit d1547ee

File tree

2 files changed

+91
-2
lines changed

2 files changed

+91
-2
lines changed

test/jasmine/tests/pie_test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1779,7 +1779,7 @@ describe('pie inside text orientation', function() {
17791779
if(pos0 !== -1) {
17801780
pos0 += 'rotate('.length;
17811781
var pos1 = transform.indexOf(')', pos0);
1782-
rotate = +(transform.substring(pos0, pos1));
1782+
rotate = +(transform.slice(pos0, pos1));
17831783
}
17841784

17851785
expect(opts.rotations[i]).toBeCloseTo(rotate, -1, 'rotation for element ' + i, msg);
@@ -1879,7 +1879,7 @@ describe('pie uniformtext', function() {
18791879
if(pos0 !== -1) {
18801880
pos0 += 'scale('.length;
18811881
var pos1 = transform.indexOf(')', pos0);
1882-
scale = +(transform.substring(pos0, pos1));
1882+
scale = +(transform.slice(pos0, pos1));
18831883
}
18841884

18851885
expect(opts.scales[i]).toBeCloseTo(scale, 1, 'scale for element ' + i, msg);

test/jasmine/tests/scattergl_test.js

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,95 @@ describe('end-to-end scattergl tests', function() {
545545
expect(getSnap()).toEqual(TOO_MANY_POINTS + 1);
546546
}).then(done, done.fail);
547547
});
548+
549+
it('@gl should not throw when plot is called with a subset of scattergl calcdata', function (done) {
550+
var layout = {
551+
width: 300,
552+
height: 300,
553+
margin: { l: 0, r: 0, t: 0, b: 0 }
554+
};
555+
var config = { plotGlPixelRatio: 1 };
556+
557+
Plotly.newPlot(gd, [{
558+
type: 'scattergl',
559+
mode: 'lines',
560+
x: [0, 1],
561+
y: [0, 1],
562+
line: { width: 10 }
563+
}, {
564+
type: 'scattergl',
565+
mode: 'lines',
566+
x: [0, 1],
567+
y: [1, 0],
568+
line: { width: 10 }
569+
}], layout, config)
570+
.then(function () {
571+
var subplot = gd._fullLayout._plots.xy;
572+
expect(subplot._scene.count).toBeGreaterThan(1);
573+
574+
expect(function () {
575+
ScatterGl.plot(gd, subplot, [gd.calcdata[1]]);
576+
}).not.toThrow();
577+
})
578+
.then(done, done.fail);
579+
});
580+
581+
582+
it('@gl should not throw when animating frames redraw=true', function (done) {
583+
var layout = {
584+
width: 400,
585+
height: 300,
586+
margin: { l: 0, r: 0, t: 0, b: 0 },
587+
xaxis: { range: [0, 30] },
588+
yaxis: { range: [0, 900] }
589+
};
590+
var config = { plotGlPixelRatio: 1 };
591+
592+
function makeXY(n) {
593+
var x = [];
594+
var y = [];
595+
for (var i = 0; i < n; i++) {
596+
x.push(i);
597+
y.push(i * i);
598+
}
599+
return { x: x, y: y };
600+
}
601+
602+
var xy0 = makeXY(0);
603+
var xy10 = makeXY(10);
604+
605+
var data = [{
606+
type: 'scattergl',
607+
mode: 'markers',
608+
marker: { size: 5 },
609+
x: xy10.x,
610+
y: xy10.y
611+
}];
612+
613+
var frames = [{
614+
name: '0',
615+
data: [{ x: xy0.x, y: xy0.y }]
616+
}, {
617+
name: '10',
618+
data: [{ x: xy10.x, y: xy10.y }]
619+
}];
620+
621+
Plotly.newPlot(gd, data, layout, config)
622+
.then(function () {
623+
return Plotly.addFrames(gd, frames);
624+
})
625+
.then(function () {
626+
return Plotly.animate(gd, ['10'], {
627+
mode: 'immediate',
628+
frame: { duration: 0, redraw: true },
629+
transition: { duration: 0 }
630+
});
631+
})
632+
.catch(failTest)
633+
.then(done);
634+
});
635+
636+
548637
});
549638

550639
describe('Test scattergl autorange:', function() {

0 commit comments

Comments
 (0)