Skip to content

Commit 84907dc

Browse files
committed
add tests for carpet
1 parent 5aca807 commit 84907dc

File tree

2 files changed

+52
-7
lines changed

2 files changed

+52
-7
lines changed

test/jasmine/tests/box_test.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -636,13 +636,11 @@ describe('Test boxes supplyDefaults', function() {
636636
});
637637
});
638638

639-
describe('Test box converting numeric strings', function() {
639+
describe('Test box autoType', function() {
640640
it('should disable converting numeric strings using axis.convertnumeric', function() {
641641
var gd = {
642642
layout: {
643-
xaxis: {
644-
convertnumeric: false
645-
}
643+
xaxis: { convertnumeric: false }
646644
},
647645
data: [{
648646
type: 'box',
@@ -667,9 +665,7 @@ describe('Test box converting numeric strings', function() {
667665
var gd = {
668666
layout: {
669667
axesconvertnumeric: false,
670-
xaxis: {
671-
convertnumeric: true
672-
}
668+
xaxis: { convertnumeric: true }
673669
},
674670
data: [{
675671
type: 'box',

test/jasmine/tests/carpet_test.js

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,55 @@ describe('supplyDefaults visibility check', function() {
217217
});
218218
});
219219

220+
describe('Test carpet autoType', function() {
221+
it('should disable converting numeric strings using axis.convertnumeric', function() {
222+
var gd = {
223+
layout: {
224+
xaxis: { convertnumeric: false },
225+
yaxis: {}
226+
},
227+
data: [{
228+
type: 'carpet',
229+
a: ['1', '2', '3'],
230+
b: ['1', '2'],
231+
x: [['1', '2', '3'], ['4', '5', '6']],
232+
y: [['1', '2', '3'], ['4', '5', '6']],
233+
}]
234+
};
235+
236+
supplyAllDefaults(gd);
237+
238+
expect(gd._fullLayout.xaxis.convertnumeric).toBe(false);
239+
expect(gd._fullLayout.yaxis.convertnumeric).toBe(true);
240+
expect(gd._fullLayout.xaxis.type).toBe('category');
241+
expect(gd._fullLayout.yaxis.type).toBe('linear');
242+
});
243+
244+
it('should enable converting numeric strings using axis.convertnumeric and inherit defaults from layout.axesconvertnumeric', function() {
245+
var gd = {
246+
layout: {
247+
axesconvertnumeric: false,
248+
xaxis: { convertnumeric: true },
249+
yaxis: {}
250+
},
251+
data: [{
252+
type: 'carpet',
253+
a: ['1', '2', '3'],
254+
b: ['1', '2'],
255+
x: [['1', '2', '3'], ['4', '5', '6']],
256+
y: [['1', '2', '3'], ['4', '5', '6']],
257+
}]
258+
};
259+
260+
supplyAllDefaults(gd);
261+
262+
expect(gd._fullLayout.xaxis.convertnumeric).toBe(true);
263+
expect(gd._fullLayout.yaxis.convertnumeric).toBe(false);
264+
expect(gd._fullLayout.xaxis.type).toBe('linear');
265+
expect(gd._fullLayout.yaxis.type).toBe('category');
266+
});
267+
});
268+
220269
describe('carpet smooth_fill_2d_array', function() {
221270
var _;
222271

0 commit comments

Comments
 (0)