Skip to content

Commit e87fee1

Browse files
committed
Add additional test
1 parent 38fd2f9 commit e87fee1

1 file changed

Lines changed: 33 additions & 1 deletion

File tree

test/jasmine/tests/histogram_test.js

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1350,7 +1350,6 @@ describe('Test histogram', function() {
13501350
Plotly.newPlot(gd, initialData, layout)
13511351
.then(function() {
13521352
// minDiff = 820 - 720 = 100
1353-
console.log("gd._fullData=", gd._fullData);
13541353
expect(gd._fullData[0].xbins.size).toBe(100);
13551354
expect(gd._fullData[1].xbins.size).toBe(100);
13561355
expect(gd._fullData[2].xbins.size).toBe(100);
@@ -1372,6 +1371,39 @@ describe('Test histogram', function() {
13721371
})
13731372
.then(done, done.fail);
13741373
});
1374+
1375+
it('should preserve user-specified xbins.size for single-value overlays on Plotly.react', function(done) {
1376+
var initialData = [
1377+
{x: ['1457'], type: 'histogram', xbins: {size: 50}},
1378+
{x: ['820'], type: 'histogram', xbins: {size: 50}},
1379+
{x: ['720'], type: 'histogram', xbins: {size: 50}}
1380+
];
1381+
1382+
var layout = {
1383+
barmode: 'overlay'
1384+
};
1385+
1386+
Plotly.newPlot(gd, initialData, layout)
1387+
.then(function() {
1388+
expect(gd._fullData[0].xbins.size).toBe(50);
1389+
expect(gd._fullData[1].xbins.size).toBe(50);
1390+
expect(gd._fullData[2].xbins.size).toBe(50);
1391+
1392+
var newData = [
1393+
{x: ['1400'], type: 'histogram', xbins: {size: 50}},
1394+
{x: ['800'], type: 'histogram', xbins: {size: 50}},
1395+
{x: ['600'], type: 'histogram', xbins: {size: 50}}
1396+
];
1397+
1398+
return Plotly.react(gd, newData, layout);
1399+
})
1400+
.then(function() {
1401+
expect(gd._fullData[0].xbins.size).toBe(50);
1402+
expect(gd._fullData[1].xbins.size).toBe(50);
1403+
expect(gd._fullData[2].xbins.size).toBe(50);
1404+
})
1405+
.then(done, done.fail);
1406+
});
13751407
});
13761408
});
13771409

0 commit comments

Comments
 (0)