Skip to content

Commit a84b2e7

Browse files
committed
Add test to verify execute: false actually disables methods
1 parent 29fcace commit a84b2e7

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

test/jasmine/tests/updatemenus_test.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,32 @@ describe('update menus interactions', function() {
448448
});
449449
});
450450

451+
it('should execute the API command when execute = true', function(done) {
452+
expect(gd.data[0].line.color).toEqual('blue');
453+
454+
click(selectHeader(0)).then(function() {
455+
return click(selectButton(2));
456+
}).then(function() {
457+
// Has been changed:
458+
expect(gd.data[0].line.color).toEqual('green');
459+
}).catch(fail).then(done);
460+
});
461+
462+
it('should not execute the API command when execute = false', function(done) {
463+
// This test is identical to the one above, except that it disables
464+
// the command by setting execute = false first:
465+
expect(gd.data[0].line.color).toEqual('blue');
466+
467+
Plotly.relayout(gd, 'updatemenus[0].buttons[2].execute', false).then(function() {
468+
return click(selectHeader(0));
469+
}).then(function() {
470+
return click(selectButton(2));
471+
}).then(function() {
472+
// Is unchanged:
473+
expect(gd.data[0].line.color).toEqual('blue');
474+
}).catch(fail).then(done);
475+
});
476+
451477
it('should emit an event on button click', function(done) {
452478
var clickCnt = 0;
453479
var data = [];

0 commit comments

Comments
 (0)