File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -85,8 +85,27 @@ describe('The legend', function() {
8585 wheelDeltaY = 100 ;
8686
8787 legend . dispatchEvent ( scrollTo ( wheelDeltaY ) ) ;
88+
8889 var dataScroll = scrollBox . getAttribute ( 'data-scroll' ) ;
90+ toggle . dispatchEvent ( new MouseEvent ( 'click' ) ) ;
91+ expect ( + toggle . parentNode . style . opacity ) . toBeLessThan ( 1 ) ;
92+ expect ( scrollBox . getAttribute ( 'data-scroll' ) ) . toBe ( dataScroll ) ;
93+ expect ( scrollBox . getAttribute ( 'transform' ) ) . toBe (
94+ 'translate(0, ' + dataScroll + ')' ) ;
95+ } ) ;
8996
97+ it ( 'should keep toggle listeners after relayout' , function ( ) {
98+ Plotly . relayout ( gd , 'showlegend' , false ) ;
99+ Plotly . relayout ( gd , 'showlegend' , true ) ;
100+
101+ var legend = document . getElementsByClassName ( 'legend' ) [ 0 ] ,
102+ scrollBox = legend . getElementsByClassName ( 'scrollbox' ) [ 0 ] ,
103+ toggle = legend . getElementsByClassName ( 'legendtoggle' ) [ 0 ] ,
104+ wheelDeltaY = 100 ;
105+
106+ legend . dispatchEvent ( scrollTo ( wheelDeltaY ) ) ;
107+
108+ var dataScroll = scrollBox . getAttribute ( 'data-scroll' ) ;
90109 toggle . dispatchEvent ( new MouseEvent ( 'click' ) ) ;
91110 expect ( + toggle . parentNode . style . opacity ) . toBeLessThan ( 1 ) ;
92111 expect ( scrollBox . getAttribute ( 'data-scroll' ) ) . toBe ( dataScroll ) ;
You can’t perform that action at this time.
0 commit comments