Skip to content

Commit 3776cd2

Browse files
committed
use sample with >1 values
... in histogram tests as a workaround for #3881
1 parent f872f76 commit 3776cd2

File tree

1 file changed

+54
-54
lines changed

1 file changed

+54
-54
lines changed

Diff for: test/jasmine/tests/histogram_test.js

+54-54
Original file line numberDiff line numberDiff line change
@@ -239,18 +239,18 @@ describe('Test histogram', function() {
239239
barModes.forEach(function(mode) {
240240
gd = {
241241
data: [
242-
{type: 'histogram', y: [1]},
243-
{type: 'histogram', y: [2]},
242+
{type: 'histogram', y: [1, 2]},
243+
{type: 'histogram', y: [2, 3]},
244244

245-
{type: 'histogram', y: [1], xaxis: 'x2'},
246-
{type: 'histogram', y: [3], xaxis: 'x2'},
245+
{type: 'histogram', y: [1, 2], xaxis: 'x2'},
246+
{type: 'histogram', y: [3, 4], xaxis: 'x2'},
247247

248-
{type: 'histogram', y: [3]},
249-
{type: 'histogram', y: [2], xaxis: 'x2'},
248+
{type: 'histogram', y: [3, 4]},
249+
{type: 'histogram', y: [2, 4], xaxis: 'x2'},
250250

251-
{type: 'histogram', x: [1]},
252-
{uid: 'solo', type: 'histogram', x: [2], yaxis: 'y2'},
253-
{type: 'histogram', x: [2]}
251+
{type: 'histogram', x: [1, 3]},
252+
{uid: 'solo', type: 'histogram', x: [2, 2], yaxis: 'y2'},
253+
{type: 'histogram', x: [2, 3]}
254254
],
255255
layout: {barmode: mode}
256256
};
@@ -270,10 +270,10 @@ describe('Test histogram', function() {
270270
barModes.forEach(function(mode) {
271271
gd = {
272272
data: [
273-
{type: 'histogram', y: [1]},
274-
{type: 'histogram', y: [2], xaxis: 'x2'},
275-
{type: 'histogram', x: [1], yaxis: 'y2'},
276-
{type: 'histogram', x: [2], yaxis: 'y2'},
273+
{type: 'histogram', y: [1, 2]},
274+
{type: 'histogram', y: [2, 3], xaxis: 'x2'},
275+
{type: 'histogram', x: [1, 2], yaxis: 'y2'},
276+
{type: 'histogram', x: [2, 3], yaxis: 'y2'},
277277
],
278278
layout: {
279279
barmode: mode,
@@ -292,18 +292,18 @@ describe('Test histogram', function() {
292292
it('should not group traces by default under barmode:overlay ', function() {
293293
gd = {
294294
data: [
295-
{uid: 'a', type: 'histogram', y: [1]},
296-
{uid: 'b', type: 'histogram', y: [2]},
295+
{uid: 'a', type: 'histogram', y: [1, 2]},
296+
{uid: 'b', type: 'histogram', y: [2, 3]},
297297

298-
{uid: 'c', type: 'histogram', y: [1], xaxis: 'x2'},
299-
{uid: 'd', type: 'histogram', y: [3], xaxis: 'x2'},
298+
{uid: 'c', type: 'histogram', y: [1, 2], xaxis: 'x2'},
299+
{uid: 'd', type: 'histogram', y: [3, 4], xaxis: 'x2'},
300300

301-
{uid: 'e', type: 'histogram', y: [3]},
302-
{uid: 'f', type: 'histogram', y: [2], xaxis: 'x2'},
301+
{uid: 'e', type: 'histogram', y: [3, 1]},
302+
{uid: 'f', type: 'histogram', y: [2, 1], xaxis: 'x2'},
303303

304-
{uid: 'g', type: 'histogram', x: [1]},
305-
{uid: 'h', type: 'histogram', x: [2], yaxis: 'y2'},
306-
{uid: 'i', type: 'histogram', x: [2]}
304+
{uid: 'g', type: 'histogram', x: [1, 2]},
305+
{uid: 'h', type: 'histogram', x: [2, 3], yaxis: 'y2'},
306+
{uid: 'i', type: 'histogram', x: [2, 4]}
307307
],
308308
layout: {barmode: 'overlay'}
309309
};
@@ -318,10 +318,10 @@ describe('Test histogram', function() {
318318
it('should not group histogram2d* traces by default', function() {
319319
gd = {
320320
data: [
321-
{uid: 'a', type: 'histogram2d', x: [1], y: [1]},
322-
{uid: 'b', type: 'histogram2d', x: [2], y: [2]},
323-
{uid: 'c', type: 'histogram2dcontour', x: [1], y: [1], xaxis: 'x2', yaxis: 'y2'},
324-
{uid: 'd', type: 'histogram2dcontour', x: [2], y: [2], xaxis: 'x2', yaxis: 'y2'},
321+
{uid: 'a', type: 'histogram2d', x: [1, 2], y: [1, 3]},
322+
{uid: 'b', type: 'histogram2d', x: [2, 3], y: [2, 3]},
323+
{uid: 'c', type: 'histogram2dcontour', x: [1, 3], y: [1, 2], xaxis: 'x2', yaxis: 'y2'},
324+
{uid: 'd', type: 'histogram2dcontour', x: [2, 3], y: [2, 4], xaxis: 'x2', yaxis: 'y2'},
325325
],
326326
layout: {}
327327
};
@@ -337,15 +337,15 @@ describe('Test histogram', function() {
337337
it('should be able to group traces by *bingroup* under barmode:overlay ', function() {
338338
gd = {
339339
data: [
340-
{bingroup: '1', type: 'histogram', y: [1]},
341-
{uid: 'b', type: 'histogram', y: [2]},
342-
{bingroup: '2', type: 'histogram', y: [1], xaxis: 'x2'},
343-
{bingroup: '1', type: 'histogram', y: [3], xaxis: 'x2'},
344-
{bingroup: '2', type: 'histogram', y: [3]},
345-
{uid: 'f', type: 'histogram', y: [2], xaxis: 'x2'},
346-
{bingroup: '3', type: 'histogram', x: [1]},
347-
{bingroup: '1', type: 'histogram', x: [2], yaxis: 'y2'},
348-
{bingroup: '3', type: 'histogram', x: [2]}
340+
{bingroup: '1', type: 'histogram', y: [1, 2]},
341+
{uid: 'b', type: 'histogram', y: [2, 3]},
342+
{bingroup: '2', type: 'histogram', y: [1, 4], xaxis: 'x2'},
343+
{bingroup: '1', type: 'histogram', y: [3, 4], xaxis: 'x2'},
344+
{bingroup: '2', type: 'histogram', y: [3, 4]},
345+
{uid: 'f', type: 'histogram', y: [2, 4], xaxis: 'x2'},
346+
{bingroup: '3', type: 'histogram', x: [1, 5]},
347+
{bingroup: '1', type: 'histogram', x: [2, 5], yaxis: 'y2'},
348+
{bingroup: '3', type: 'histogram', x: [2, 5]}
349349
],
350350
layout: {barmode: 'overlay'}
351351
};
@@ -362,11 +362,11 @@ describe('Test histogram', function() {
362362
it('should be able to group histogram2d traces by *bingroup*', function() {
363363
gd = {
364364
data: [
365-
{uid: 'a', type: 'histogram2d', x: [1], y: [1]},
366-
{uid: 'b', type: 'histogram2d', x: [1], y: [1]},
367-
{bingroup: '1', type: 'histogram2d', x: [1], y: [1]},
368-
{bingroup: '1', type: 'histogram2d', x: [1], y: [1]},
369-
{uid: 'e', type: 'histogram2d', x: [1], y: [1]},
365+
{uid: 'a', type: 'histogram2d', x: [1, 2], y: [1, 2]},
366+
{uid: 'b', type: 'histogram2d', x: [1, 3], y: [1, 1]},
367+
{bingroup: '1', type: 'histogram2d', x: [1, 2], y: [1, 2]},
368+
{bingroup: '1', type: 'histogram2d', x: [1, 2], y: [1, 2]},
369+
{uid: 'e', type: 'histogram2d', x: [1, 3], y: [1, 3]},
370370
]
371371
};
372372
supplyAllDefaults(gd);
@@ -382,10 +382,10 @@ describe('Test histogram', function() {
382382
it('should be able to group histogram and histogram2d* traces together', function() {
383383
gd = {
384384
data: [
385-
{bingroup: '1', type: 'histogram', y: [1]},
386-
{bingroup: '1', type: 'histogram', y: [3], xaxis: 'x2'},
387-
{bingroup: '1', type: 'histogram2d', x: [1], y: [3]},
388-
{bingroup: '1', type: 'histogram2dcontour', x: [1], y: [3]}
385+
{bingroup: '1', type: 'histogram', y: [1, 3]},
386+
{bingroup: '1', type: 'histogram', y: [3, 3], xaxis: 'x2'},
387+
{bingroup: '1', type: 'histogram2d', x: [1, 3], y: [3, 2]},
388+
{bingroup: '1', type: 'histogram2dcontour', x: [1, 2], y: [3, 4]}
389389
],
390390
layout: {barmode: 'overlay'}
391391
};
@@ -400,8 +400,8 @@ describe('Test histogram', function() {
400400
it('should not group traces across axes of different types', function() {
401401
gd = {
402402
data: [
403-
{uid: 'a', bingroup: '1', type: 'histogram', y: [1]},
404-
{uid: 'b', bingroup: '1', type: 'histogram', y: ['cats'], yaxis: 'y2'},
403+
{uid: 'a', bingroup: '1', type: 'histogram', y: [1, 2]},
404+
{uid: 'b', bingroup: '1', type: 'histogram', y: ['cats', 'dogs'], yaxis: 'y2'},
405405
],
406406
layout: {barmode: 'overlay'}
407407
};
@@ -420,9 +420,9 @@ describe('Test histogram', function() {
420420
gd = {
421421
data: [
422422
// these 3 traces "have to match"
423-
{bingroup: '1', type: 'histogram', y: [1]},
424-
{type: 'histogram', y: [1]},
425-
{bingroup: '2', type: 'histogram', y: [2]}
423+
{bingroup: '1', type: 'histogram', y: [1, 2]},
424+
{type: 'histogram', y: [1, 3]},
425+
{bingroup: '2', type: 'histogram', y: [2, 3]}
426426
],
427427
layout: {barmode: 'stack'}
428428
};
@@ -440,15 +440,15 @@ describe('Test histogram', function() {
440440
gd = {
441441
data: [
442442
// these 2 traces "have to match"
443-
{bingroup: '1', type: 'histogram', y: [1]},
444-
{type: 'histogram', y: [1]},
443+
{bingroup: '1', type: 'histogram', y: [1, 3]},
444+
{type: 'histogram', y: [1, 3]},
445445
// this one does not have to match with the above two,
446446
// (it's on another subplot), but it can be grouped
447-
{bingroup: '1', type: 'histogram', y: [2], xaxis: 'x2', yaxis: 'y2'},
447+
{bingroup: '1', type: 'histogram', y: [2, 3], xaxis: 'x2', yaxis: 'y2'},
448448
// this one does not have to match either
449449
// (it's a histogram2d* traces), but it can be grouped
450450
// TODO should this be just "bingroup"???
451-
{xbingroup: '1', ybingroup: '1', type: 'histogram2d', x: [3], y: [3]}
451+
{xbingroup: '1', ybingroup: '1', type: 'histogram2d', x: [3, 4], y: [3, 4]}
452452
],
453453
layout: {}
454454
};
@@ -486,7 +486,7 @@ describe('Test histogram', function() {
486486
traces = [{}, {}, {yaxis: 'y2'}, {yaxis: 'y2'}];
487487
traces.forEach(function(t) {
488488
t.type = 'histogram';
489-
t.x = [1];
489+
t.x = [1, 2];
490490
});
491491
}
492492

0 commit comments

Comments
 (0)