Skip to content

Commit aeb1626

Browse files
committedMay 14, 2021
rename modebar.buttonstoadd to modebar.add
1 parent 3933b88 commit aeb1626

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed
 

‎src/components/modebar/attributes.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ module.exports = {
3434
'root level and inside subplots. Defaults to `layout.uirevision`.'
3535
].join(' ')
3636
},
37-
buttonstoadd: {
37+
add: {
3838
valType: 'flaglist',
3939
flags: [
4040
'v1hovermode',

‎src/components/modebar/defaults.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) {
1919
coerce('color', Color.addOpacity(defaultColor, 0.3));
2020
coerce('activecolor', Color.addOpacity(defaultColor, 0.7));
2121
coerce('uirevision', layoutOut.uirevision);
22-
coerce('buttonstoadd');
22+
coerce('add');
2323
};

‎src/components/modebar/manage.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ function getButtonGroups(gd) {
7272
var fullLayout = gd._fullLayout;
7373
var fullData = gd._fullData;
7474
var context = gd._context;
75-
var layoutButtonsToAdd = fullLayout.modebar.buttonstoadd.split('+');
75+
var layoutButtonsToAdd = fullLayout.modebar.add.split('+');
7676
var buttonsToAdd = context.modeBarButtonsToAdd.concat(layoutButtonsToAdd);
7777
var buttonsToRemove = context.modeBarButtonsToRemove;
7878

‎test/jasmine/tests/modebar_test.js

+11-11
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ describe('ModeBar', function() {
4242
_has: Plots._hasPlotType,
4343
_subplots: {xaxis: xaxes || [], yaxis: yaxes || []},
4444
modebar: {
45-
buttonstoadd: '',
45+
add: '',
4646
orientation: 'h',
4747
bgcolor: 'rgba(255,255,255,0.7)',
4848
color: 'rgba(0, 31, 95, 0.3)',
@@ -1560,7 +1560,7 @@ describe('ModeBar', function() {
15601560
.then(done, done.fail);
15611561
});
15621562

1563-
it('add and remove predefined shape drawing and hover buttons via layout.modebar.buttonstoadd and template', function(done) {
1563+
it('add and remove predefined shape drawing and hover buttons via layout.modebar.add and template', function(done) {
15641564
function countButtons() {
15651565
var modeBarEl = gd._fullLayout._modeBar.element;
15661566
return d3Select(modeBarEl).selectAll('a.modebar-btn').size();
@@ -1571,7 +1571,7 @@ describe('ModeBar', function() {
15711571
.then(function() {
15721572
expect(countButtons()).toBe(initial);
15731573

1574-
return Plotly.relayout(gd, 'modebar.buttonstoadd', [
1574+
return Plotly.relayout(gd, 'modebar.add', [
15751575
'drawline',
15761576
'drawopenpath',
15771577
'drawclosedpath',
@@ -1583,12 +1583,12 @@ describe('ModeBar', function() {
15831583
.then(function() {
15841584
expect(countButtons()).toBe(initial + 6);
15851585

1586-
return Plotly.relayout(gd, 'modebar.buttonstoadd', '');
1586+
return Plotly.relayout(gd, 'modebar.add', '');
15871587
})
15881588
.then(function() {
15891589
expect(countButtons()).toBe(initial);
15901590

1591-
return Plotly.relayout(gd, 'modebar.buttonstoadd', [
1591+
return Plotly.relayout(gd, 'modebar.add', [
15921592
'hovercompare',
15931593
'hoverclosest',
15941594
'togglespikelines'
@@ -1597,20 +1597,20 @@ describe('ModeBar', function() {
15971597
.then(function() {
15981598
expect(countButtons()).toBe(initial + 3);
15991599

1600-
return Plotly.relayout(gd, 'modebar.buttonstoadd', '');
1600+
return Plotly.relayout(gd, 'modebar.add', '');
16011601
})
16021602
.then(function() {
16031603
expect(countButtons()).toBe(initial);
16041604

1605-
return Plotly.relayout(gd, 'modebar.buttonstoadd', [
1605+
return Plotly.relayout(gd, 'modebar.add', [
16061606
'v1hovermode',
16071607
'togglespikelines'
16081608
].join('+'));
16091609
})
16101610
.then(function() {
16111611
expect(countButtons()).toBe(initial + 3);
16121612

1613-
return Plotly.relayout(gd, 'modebar.buttonstoadd', [
1613+
return Plotly.relayout(gd, 'modebar.add', [
16141614
'v1hovermode',
16151615
'togglespikelines',
16161616
'togglehover',
@@ -1624,20 +1624,20 @@ describe('ModeBar', function() {
16241624
.then(function() {
16251625
expect(countButtons()).toBe(initial + 4, 'skip duplicates');
16261626

1627-
return Plotly.relayout(gd, 'modebar.buttonstoadd', [
1627+
return Plotly.relayout(gd, 'modebar.add', [
16281628
'drawline',
16291629
'invalid'
16301630
].join('+'));
16311631
})
16321632
.then(function() {
16331633
expect(countButtons()).toBe(initial + 1, 'skip invalid');
16341634

1635-
return Plotly.relayout(gd, 'modebar.buttonstoadd', '');
1635+
return Plotly.relayout(gd, 'modebar.add', '');
16361636
})
16371637
.then(function() {
16381638
expect(countButtons()).toBe(initial);
16391639

1640-
return Plotly.relayout(gd, 'template.layout.modebar.buttonstoadd', 'v1hovermode');
1640+
return Plotly.relayout(gd, 'template.layout.modebar.add', 'v1hovermode');
16411641
})
16421642
.then(function() {
16431643
expect(countButtons()).toBe(initial + 2, 'via template');

0 commit comments

Comments
 (0)