Skip to content

Commit f5d6113

Browse files
committed
separate the new date rendering tests from axes_test.js
1 parent ab4ffbf commit f5d6113

File tree

2 files changed

+84
-79
lines changed

2 files changed

+84
-79
lines changed

test/jasmine/tests/axes_test.js

-79
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ var Plots = require('@src/plots/plots');
44
var Lib = require('@src/lib');
55
var Color = require('@src/components/color');
66
var tinycolor = require('tinycolor2');
7-
var hasWebGLSupport = require('../assets/has_webgl_support');
87

98
var handleTickValueDefaults = require('@src/plots/cartesian/tick_value_defaults');
109
var Axes = PlotlyInternal.Axes;
@@ -388,84 +387,6 @@ describe('Test axes', function() {
388387
});
389388
});
390389

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

471392
var gd;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
var PlotlyInternal = require('@src/plotly');
2+
3+
var hasWebGLSupport = require('../assets/has_webgl_support');
4+
5+
var createGraphDiv = require('../assets/create_graph_div');
6+
var destroyGraphDiv = require('../assets/destroy_graph_div');
7+
8+
describe('date axis', function() {
9+
10+
if(!hasWebGLSupport('axes_test date axis')) return;
11+
12+
var gd;
13+
14+
beforeEach(function() {
15+
gd = createGraphDiv();
16+
});
17+
18+
afterEach(destroyGraphDiv);
19+
20+
it('should use the fancy gl-vis/gl-scatter2d', function() {
21+
PlotlyInternal.plot(gd, [{
22+
type: 'scattergl',
23+
'marker': {
24+
'color': 'rgb(31, 119, 180)',
25+
'size': 18,
26+
'symbol': [
27+
'diamond',
28+
'cross'
29+
]
30+
},
31+
x: [new Date('2016-10-10'), new Date('2016-10-12')],
32+
y: [15, 16]
33+
}]);
34+
35+
expect(gd._fullLayout.xaxis.type).toBe('date');
36+
expect(gd._fullLayout.yaxis.type).toBe('linear');
37+
expect(gd._fullData[0].type).toBe('scattergl');
38+
expect(gd._fullData[0]._module.basePlotModule.name).toBe('gl2d');
39+
40+
// 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);
42+
});
43+
44+
it('should use the fancy gl-vis/gl-scatter2d once again', function() {
45+
PlotlyInternal.plot(gd, [{
46+
type: 'scattergl',
47+
'marker': {
48+
'color': 'rgb(31, 119, 180)',
49+
'size': 36,
50+
'symbol': [
51+
'circle',
52+
'cross'
53+
]
54+
},
55+
x: [new Date('2016-10-10'), new Date('2016-10-11')],
56+
y: [15, 16]
57+
}]);
58+
59+
expect(gd._fullLayout.xaxis.type).toBe('date');
60+
expect(gd._fullLayout.yaxis.type).toBe('linear');
61+
expect(gd._fullData[0].type).toBe('scattergl');
62+
expect(gd._fullData[0]._module.basePlotModule.name).toBe('gl2d');
63+
64+
// 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);
66+
});
67+
68+
it('should now use the non-fancy gl-vis/gl-scatter2d', function() {
69+
PlotlyInternal.plot(gd, [{
70+
type: 'scattergl',
71+
mode: 'markers', // important, as otherwise lines are assumed (which needs fancy)
72+
x: [new Date('2016-10-10'), new Date('2016-10-11')],
73+
y: [15, 16]
74+
}]);
75+
76+
expect(gd._fullLayout.xaxis.type).toBe('date');
77+
expect(gd._fullLayout.yaxis.type).toBe('linear');
78+
expect(gd._fullData[0].type).toBe('scattergl');
79+
expect(gd._fullData[0]._module.basePlotModule.name).toBe('gl2d');
80+
81+
expect(gd._fullLayout._plots.xy._scene2d.glplot.objects[3].pointCount).toBe(2);
82+
});
83+
84+
});

0 commit comments

Comments
 (0)