Skip to content

Commit f127872

Browse files
committed
fixup gl2d looking for scattergl trace objects
1 parent ed38e70 commit f127872

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

test/jasmine/tests/gl2d_date_axis_render_test.js

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var PlotlyInternal = require('@src/plotly');
1+
var Plotly = require('@lib');
22

33
var hasWebGLSupport = require('../assets/has_webgl_support');
44

@@ -18,7 +18,7 @@ describe('date axis', function() {
1818
afterEach(destroyGraphDiv);
1919

2020
it('should use the fancy gl-vis/gl-scatter2d', function() {
21-
PlotlyInternal.plot(gd, [{
21+
Plotly.plot(gd, [{
2222
type: 'scattergl',
2323
'marker': {
2424
'color': 'rgb(31, 119, 180)',
@@ -38,11 +38,13 @@ describe('date axis', function() {
3838
expect(gd._fullData[0]._module.basePlotModule.name).toBe('gl2d');
3939

4040
// one way of check which renderer - fancy vs not - we're using
41-
expect(gd._fullLayout._plots.xy._scene2d.glplot.objects[3].pointCount).toBe(0);
41+
var objs = gd._fullLayout._plots.xy._scene2d.glplot.objects;
42+
expect(objs.length).toEqual(2);
43+
expect(objs[1].points.length).toEqual(4);
4244
});
4345

4446
it('should use the fancy gl-vis/gl-scatter2d once again', function() {
45-
PlotlyInternal.plot(gd, [{
47+
Plotly.plot(gd, [{
4648
type: 'scattergl',
4749
'marker': {
4850
'color': 'rgb(31, 119, 180)',
@@ -62,11 +64,13 @@ describe('date axis', function() {
6264
expect(gd._fullData[0]._module.basePlotModule.name).toBe('gl2d');
6365

6466
// one way of check which renderer - fancy vs not - we're using
65-
expect(gd._fullLayout._plots.xy._scene2d.glplot.objects[3].pointCount).toBe(0);
67+
var objs = gd._fullLayout._plots.xy._scene2d.glplot.objects;
68+
expect(objs.length).toEqual(2);
69+
expect(objs[1].points.length).toEqual(4);
6670
});
6771

6872
it('should now use the non-fancy gl-vis/gl-scatter2d', function() {
69-
PlotlyInternal.plot(gd, [{
73+
Plotly.plot(gd, [{
7074
type: 'scattergl',
7175
mode: 'markers', // important, as otherwise lines are assumed (which needs fancy)
7276
x: [new Date('2016-10-10'), new Date('2016-10-11')],
@@ -78,11 +82,13 @@ describe('date axis', function() {
7882
expect(gd._fullData[0].type).toBe('scattergl');
7983
expect(gd._fullData[0]._module.basePlotModule.name).toBe('gl2d');
8084

81-
expect(gd._fullLayout._plots.xy._scene2d.glplot.objects[3].pointCount).toBe(2);
85+
var objs = gd._fullLayout._plots.xy._scene2d.glplot.objects;
86+
expect(objs.length).toEqual(1);
87+
expect(objs[0].pointCount).toEqual(2);
8288
});
8389

8490
it('should use the non-fancy gl-vis/gl-scatter2d with string dates', function() {
85-
PlotlyInternal.plot(gd, [{
91+
Plotly.plot(gd, [{
8692
type: 'scattergl',
8793
mode: 'markers', // important, as otherwise lines are assumed (which needs fancy)
8894
x: ['2016-10-10', '2016-10-11'],
@@ -94,6 +100,8 @@ describe('date axis', function() {
94100
expect(gd._fullData[0].type).toBe('scattergl');
95101
expect(gd._fullData[0]._module.basePlotModule.name).toBe('gl2d');
96102

97-
expect(gd._fullLayout._plots.xy._scene2d.glplot.objects[3].pointCount).toBe(2);
103+
var objs = gd._fullLayout._plots.xy._scene2d.glplot.objects;
104+
expect(objs.length).toEqual(1);
105+
expect(objs[0].pointCount).toEqual(2);
98106
});
99107
});

test/jasmine/tests/gl_plot_interact_test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,9 @@ describe('Test gl plot interactions', function() {
375375
});
376376

377377
it('should be able to toggle visibility', function(done) {
378-
var OBJECT_PER_TRACE = 5;
378+
379+
// a line object + scatter fancy
380+
var OBJECT_PER_TRACE = 2;
379381

380382
var objects = function() {
381383
return gd._fullLayout._plots.xy._scene2d.glplot.objects;

0 commit comments

Comments
 (0)