Skip to content

Commit 48fabdd

Browse files
committed
add gl3d tests
1 parent 3b1dd0f commit 48fabdd

File tree

1 file changed

+64
-1
lines changed

1 file changed

+64
-1
lines changed

test/jasmine/tests/gl3dlayout_test.js

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ describe('Test gl3d axes defaults', function() {
2626
};
2727

2828
beforeEach(function() {
29-
layoutOut = {};
29+
layoutOut = {
30+
axesconvertnumeric: true
31+
};
3032
});
3133

3234
it('should define specific default set with empty initial layout', function() {
@@ -128,6 +130,7 @@ describe('Test Gl3d layout defaults', function() {
128130

129131
beforeEach(function() {
130132
layoutOut = {
133+
axesconvertnumeric: true,
131134
_basePlotModules: ['gl3d'],
132135
_dfltTitle: {x: 'xxx', y: 'yyy', colorbar: 'cbbb'},
133136
_subplots: {gl3d: ['scene']}
@@ -380,6 +383,66 @@ describe('Test Gl3d layout defaults', function() {
380383
expect(layoutOut.scene.zaxis.gridcolor)
381384
.toEqual(tinycolor.mix('#444', bgColor, frac).toRgbString());
382385
});
386+
387+
it('should disable converting numeric strings using axis.convertnumeric', function() {
388+
supplyLayoutDefaults({
389+
scene: {
390+
xaxis: {
391+
convertnumeric: false
392+
},
393+
yaxis: {
394+
convertnumeric: false
395+
},
396+
zaxis: {
397+
convertnumeric: false
398+
}
399+
}
400+
}, layoutOut, [{
401+
type: 'scatter3d',
402+
x: ['0', '1', '1970', '2000'],
403+
y: ['0', '1', '1970', '2000'],
404+
z: ['0', '1', '1970', '2000'],
405+
scene: 'scene'
406+
}]);
407+
408+
expect(layoutOut.scene.xaxis.convertnumeric).toBe(false);
409+
expect(layoutOut.scene.yaxis.convertnumeric).toBe(false);
410+
expect(layoutOut.scene.zaxis.convertnumeric).toBe(false);
411+
expect(layoutOut.scene.xaxis.type).toBe('category');
412+
expect(layoutOut.scene.yaxis.type).toBe('category');
413+
expect(layoutOut.scene.zaxis.type).toBe('category');
414+
});
415+
416+
it('should enable converting numeric strings using axis.convertnumeric and inherit defaults from layout.axesconvertnumeric', function() {
417+
layoutOut.axesconvertnumeric = false;
418+
419+
supplyLayoutDefaults({
420+
scene: {
421+
xaxis: {
422+
convertnumeric: true
423+
},
424+
yaxis: {
425+
convertnumeric: true
426+
},
427+
zaxis: {
428+
convertnumeric: true
429+
}
430+
}
431+
}, layoutOut, [{
432+
type: 'scatter3d',
433+
x: ['0', '1', '1970', '2000'],
434+
y: ['0', '1', '1970', '2000'],
435+
z: ['0', '1', '1970', '2000'],
436+
scene: 'scene'
437+
}]);
438+
439+
expect(layoutOut.scene.xaxis.convertnumeric).toBe(true);
440+
expect(layoutOut.scene.yaxis.convertnumeric).toBe(true);
441+
expect(layoutOut.scene.zaxis.convertnumeric).toBe(true);
442+
expect(layoutOut.scene.xaxis.type).toBe('linear');
443+
expect(layoutOut.scene.yaxis.type).toBe('linear');
444+
expect(layoutOut.scene.zaxis.type).toBe('linear');
445+
});
383446
});
384447
});
385448

0 commit comments

Comments
 (0)