File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -448,6 +448,32 @@ describe('update menus interactions', function() {
448
448
} ) ;
449
449
} ) ;
450
450
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
+
451
477
it ( 'should emit an event on button click' , function ( done ) {
452
478
var clickCnt = 0 ;
453
479
var data = [ ] ;
You can’t perform that action at this time.
0 commit comments