diff --git a/src/components/modebar/attributes.js b/src/components/modebar/attributes.js index 73bd848e337..196b124e4e2 100644 --- a/src/components/modebar/attributes.js +++ b/src/components/modebar/attributes.js @@ -34,7 +34,7 @@ module.exports = { 'root level and inside subplots. Defaults to `layout.uirevision`.' ].join(' ') }, - buttonstoadd: { + add: { valType: 'flaglist', flags: [ 'v1hovermode', diff --git a/src/components/modebar/defaults.js b/src/components/modebar/defaults.js index d96b8783a8a..35b5352d191 100644 --- a/src/components/modebar/defaults.js +++ b/src/components/modebar/defaults.js @@ -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'); }; diff --git a/src/components/modebar/manage.js b/src/components/modebar/manage.js index 2a31106d53b..1c36beb6ae9 100644 --- a/src/components/modebar/manage.js +++ b/src/components/modebar/manage.js @@ -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; diff --git a/test/jasmine/tests/modebar_test.js b/test/jasmine/tests/modebar_test.js index 5ca65194026..ff29c8aab4a 100644 --- a/test/jasmine/tests/modebar_test.js +++ b/test/jasmine/tests/modebar_test.js @@ -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)', @@ -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(); @@ -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', @@ -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' @@ -1597,12 +1597,12 @@ 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('+')); @@ -1610,7 +1610,7 @@ describe('ModeBar', function() { .then(function() { expect(countButtons()).toBe(initial + 3); - return Plotly.relayout(gd, 'modebar.buttonstoadd', [ + return Plotly.relayout(gd, 'modebar.add', [ 'v1hovermode', 'togglespikelines', 'togglehover', @@ -1624,7 +1624,7 @@ 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('+')); @@ -1632,12 +1632,12 @@ describe('ModeBar', function() { .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');