Skip to content

Commit 2ead564

Browse files
committed
adding tests for fancy vs non-fancy scattergl
1 parent a23756d commit 2ead564

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed

test/jasmine/tests/axes_test.js

+76
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,82 @@ describe('Test axes', function() {
387387
});
388388
});
389389

390+
describe('date axis', function() {
391+
392+
var gd;
393+
394+
beforeEach(function() {
395+
gd = createGraphDiv();
396+
});
397+
398+
afterEach(destroyGraphDiv);
399+
400+
it('should use the fancy gl-vis/gl-scatter2d', function() {
401+
PlotlyInternal.plot(gd, [{
402+
type: 'scattergl',
403+
'marker': {
404+
'color': 'rgb(31, 119, 180)',
405+
'size': 18,
406+
'symbol': [
407+
'diamond',
408+
'cross'
409+
]
410+
},
411+
x: [new Date('2016-10-10'), new Date('2016-10-12')],
412+
y: [15, 16]
413+
}]);
414+
415+
expect(gd._fullLayout.xaxis.type).toBe('date');
416+
expect(gd._fullLayout.yaxis.type).toBe('linear');
417+
expect(gd._fullData[0].type).toBe('scattergl');
418+
expect(gd._fullData[0]._module.basePlotModule.name).toBe('gl2d');
419+
420+
// one way of check which renderer - fancy vs not - we're using
421+
expect(gd._fullLayout._plots.xy._scene2d.glplot.objects[3].pointCount).toBe(0);
422+
});
423+
424+
it('should use the fancy gl-vis/gl-scatter2d once again', function() {
425+
PlotlyInternal.plot(gd, [{
426+
type: 'scattergl',
427+
'marker': {
428+
'color': 'rgb(31, 119, 180)',
429+
'size': 36,
430+
'symbol': [
431+
'circle',
432+
'cross'
433+
]
434+
},
435+
x: [new Date('2016-10-10'), new Date('2016-10-11')],
436+
y: [15, 16]
437+
}]);
438+
439+
expect(gd._fullLayout.xaxis.type).toBe('date');
440+
expect(gd._fullLayout.yaxis.type).toBe('linear');
441+
expect(gd._fullData[0].type).toBe('scattergl');
442+
expect(gd._fullData[0]._module.basePlotModule.name).toBe('gl2d');
443+
444+
// one way of check which renderer - fancy vs not - we're using
445+
expect(gd._fullLayout._plots.xy._scene2d.glplot.objects[3].pointCount).toBe(0);
446+
});
447+
448+
it('should now use the non-fancy gl-vis/gl-scatter2d', function() {
449+
PlotlyInternal.plot(gd, [{
450+
type: 'scattergl',
451+
mode: 'markers', // important, as otherwise lines are assumed (which needs fancy)
452+
x: [new Date('2016-10-10'), new Date('2016-10-11')],
453+
y: [15, 16]
454+
}]);
455+
456+
expect(gd._fullLayout.xaxis.type).toBe('date');
457+
expect(gd._fullLayout.yaxis.type).toBe('linear');
458+
expect(gd._fullData[0].type).toBe('scattergl');
459+
expect(gd._fullData[0]._module.basePlotModule.name).toBe('gl2d');
460+
461+
expect(gd._fullLayout._plots.xy._scene2d.glplot.objects[3].pointCount).toBe(2);
462+
});
463+
464+
});
465+
390466
describe('categoryorder', function() {
391467

392468
var gd;

0 commit comments

Comments
 (0)