Skip to content

Commit

Permalink
rename modebar.buttonstoadd to modebar.add
Browse files Browse the repository at this point in the history
  • Loading branch information
archmoj committed May 14, 2021
1 parent 3933b88 commit aeb1626
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/components/modebar/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module.exports = {
'root level and inside subplots. Defaults to `layout.uirevision`.'
].join(' ')
},
buttonstoadd: {
add: {
valType: 'flaglist',
flags: [
'v1hovermode',
Expand Down
2 changes: 1 addition & 1 deletion src/components/modebar/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) {
coerce('color', Color.addOpacity(defaultColor, 0.3));
coerce('activecolor', Color.addOpacity(defaultColor, 0.7));
coerce('uirevision', layoutOut.uirevision);
coerce('buttonstoadd');
coerce('add');
};
2 changes: 1 addition & 1 deletion src/components/modebar/manage.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function getButtonGroups(gd) {
var fullLayout = gd._fullLayout;
var fullData = gd._fullData;
var context = gd._context;
var layoutButtonsToAdd = fullLayout.modebar.buttonstoadd.split('+');
var layoutButtonsToAdd = fullLayout.modebar.add.split('+');
var buttonsToAdd = context.modeBarButtonsToAdd.concat(layoutButtonsToAdd);
var buttonsToRemove = context.modeBarButtonsToRemove;

Expand Down
22 changes: 11 additions & 11 deletions test/jasmine/tests/modebar_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe('ModeBar', function() {
_has: Plots._hasPlotType,
_subplots: {xaxis: xaxes || [], yaxis: yaxes || []},
modebar: {
buttonstoadd: '',
add: '',
orientation: 'h',
bgcolor: 'rgba(255,255,255,0.7)',
color: 'rgba(0, 31, 95, 0.3)',
Expand Down Expand Up @@ -1560,7 +1560,7 @@ describe('ModeBar', function() {
.then(done, done.fail);
});

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

return Plotly.relayout(gd, 'modebar.buttonstoadd', [
return Plotly.relayout(gd, 'modebar.add', [
'drawline',
'drawopenpath',
'drawclosedpath',
Expand All @@ -1583,12 +1583,12 @@ describe('ModeBar', function() {
.then(function() {
expect(countButtons()).toBe(initial + 6);

return Plotly.relayout(gd, 'modebar.buttonstoadd', '');
return Plotly.relayout(gd, 'modebar.add', '');
})
.then(function() {
expect(countButtons()).toBe(initial);

return Plotly.relayout(gd, 'modebar.buttonstoadd', [
return Plotly.relayout(gd, 'modebar.add', [
'hovercompare',
'hoverclosest',
'togglespikelines'
Expand All @@ -1597,20 +1597,20 @@ describe('ModeBar', function() {
.then(function() {
expect(countButtons()).toBe(initial + 3);

return Plotly.relayout(gd, 'modebar.buttonstoadd', '');
return Plotly.relayout(gd, 'modebar.add', '');
})
.then(function() {
expect(countButtons()).toBe(initial);

return Plotly.relayout(gd, 'modebar.buttonstoadd', [
return Plotly.relayout(gd, 'modebar.add', [
'v1hovermode',
'togglespikelines'
].join('+'));
})
.then(function() {
expect(countButtons()).toBe(initial + 3);

return Plotly.relayout(gd, 'modebar.buttonstoadd', [
return Plotly.relayout(gd, 'modebar.add', [
'v1hovermode',
'togglespikelines',
'togglehover',
Expand All @@ -1624,20 +1624,20 @@ describe('ModeBar', function() {
.then(function() {
expect(countButtons()).toBe(initial + 4, 'skip duplicates');

return Plotly.relayout(gd, 'modebar.buttonstoadd', [
return Plotly.relayout(gd, 'modebar.add', [
'drawline',
'invalid'
].join('+'));
})
.then(function() {
expect(countButtons()).toBe(initial + 1, 'skip invalid');

return Plotly.relayout(gd, 'modebar.buttonstoadd', '');
return Plotly.relayout(gd, 'modebar.add', '');
})
.then(function() {
expect(countButtons()).toBe(initial);

return Plotly.relayout(gd, 'template.layout.modebar.buttonstoadd', 'v1hovermode');
return Plotly.relayout(gd, 'template.layout.modebar.add', 'v1hovermode');
})
.then(function() {
expect(countButtons()).toBe(initial + 2, 'via template');
Expand Down

0 comments on commit aeb1626

Please sign in to comment.