Skip to content

Fix logic for display modebar plot config [fixes #56] #57

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 1, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/components/modebar/manage.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ module.exports = function manageModeBar(gd) {
context = gd._context,
modeBar = fullLayout._modeBar;

if(!context.displayModeBar && modeBar) {
modeBar.destroy();
delete fullLayout._modeBar;
if(!context.displayModeBar) {
if(modeBar) {
modeBar.destroy();
delete fullLayout._modeBar;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

before, displayModeBar was only handle when updating an existing mode bar.

return;
}

Expand Down
8 changes: 8 additions & 0 deletions test/jasmine/tests/modebar_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,14 @@ describe('ModeBar', function() {
});

it('displays or not mode bar according to displayModeBar config arg', function() {
var gd = getMockGraphInfo();
gd._context.displayModeBar = false;

manageModeBar(gd);
expect(gd._fullLayout._modeBar).not.toBeDefined();
});

it('updates mode bar according to displayModeBar config arg', function() {
var gd = getMockGraphInfo();
manageModeBar(gd);
expect(gd._fullLayout._modeBar).toBeDefined();
Expand Down