@@ -140,6 +140,31 @@ describe('update menus defaults', function() {
140140 } ) ;
141141 } ) ;
142142
143+ it ( 'allow the `skip` method' , function ( ) {
144+ layoutIn . updatemenus = [ {
145+ buttons : [ {
146+ method : 'skip' ,
147+ } , {
148+ method : 'skip' ,
149+ args : [ 'title' , 'Hello World' ]
150+ } ]
151+ } ] ;
152+
153+ supply ( layoutIn , layoutOut ) ;
154+
155+ expect ( layoutOut . updatemenus [ 0 ] . buttons . length ) . toEqual ( 2 ) ;
156+ expect ( layoutOut . updatemenus [ 0 ] . buttons [ 0 ] ) . toEqual ( {
157+ method : 'skip' ,
158+ label : '' ,
159+ _index : 0
160+ } , {
161+ method : 'skip' ,
162+ args : [ 'title' , 'Hello World' ] ,
163+ label : '' ,
164+ _index : 1
165+ } ) ;
166+ } ) ;
167+
143168 it ( 'should keep ref to input update menu container' , function ( ) {
144169 layoutIn . updatemenus = [ {
145170 buttons : [ {
@@ -444,6 +469,33 @@ describe('update menus interactions', function() {
444469 } ) . catch ( fail ) . then ( done ) ;
445470 } ) ;
446471
472+ it ( 'should still emit the event if method = skip' , function ( done ) {
473+ var clickCnt = 0 ;
474+ var data = [ ] ;
475+ gd . on ( 'plotly_buttonclicked' , function ( datum ) {
476+ data . push ( datum ) ;
477+ clickCnt ++ ;
478+ } ) ;
479+
480+ Plotly . relayout ( gd , {
481+ 'updatemenus[0].buttons[0].method' : 'skip' ,
482+ 'updatemenus[0].buttons[1].method' : 'skip' ,
483+ 'updatemenus[0].buttons[2].method' : 'skip' ,
484+ 'updatemenus[1].buttons[0].method' : 'skip' ,
485+ 'updatemenus[1].buttons[1].method' : 'skip' ,
486+ 'updatemenus[1].buttons[2].method' : 'skip' ,
487+ 'updatemenus[1].buttons[3].method' : 'skip' ,
488+ } ) . then ( function ( ) {
489+ click ( selectHeader ( 0 ) ) . then ( function ( ) {
490+ expect ( clickCnt ) . toEqual ( 0 ) ;
491+
492+ return click ( selectButton ( 2 ) ) ;
493+ } ) . then ( function ( ) {
494+ expect ( clickCnt ) . toEqual ( 1 ) ;
495+ } ) . catch ( fail ) . then ( done ) ;
496+ } ) ;
497+ } ) ;
498+
447499 it ( 'should apply update on button click' , function ( done ) {
448500 var header0 = selectHeader ( 0 ) ,
449501 header1 = selectHeader ( 1 ) ;
0 commit comments