@@ -94,14 +94,22 @@ describe('The legend', function() {
9494 'translate(0, ' + dataScroll + ')' ) ;
9595 } ) ;
9696
97- it ( 'should keep toggle listeners after relayout' , function ( ) {
97+ it ( 'should be restored and functional after relayout' , function ( ) {
98+ var wheelDeltaY = 100 ,
99+ legend = document . getElementsByClassName ( 'legend' ) [ 0 ] ,
100+ scrollBox ,
101+ scrollBar ,
102+ toggle ;
103+
104+ legend . dispatchEvent ( scrollTo ( wheelDeltaY ) ) ;
105+
98106 Plotly . relayout ( gd , 'showlegend' , false ) ;
99107 Plotly . relayout ( gd , 'showlegend' , true ) ;
100108
101- var legend = document . getElementsByClassName ( 'legend' ) [ 0 ] ,
102- scrollBox = legend . getElementsByClassName ( 'scrollbox' ) [ 0 ] ,
103- toggle = legend . getElementsByClassName ( 'legendtoggle ' ) [ 0 ] ,
104- wheelDeltaY = 100 ;
109+ legend = document . getElementsByClassName ( 'legend' ) [ 0 ] ;
110+ scrollBox = legend . getElementsByClassName ( 'scrollbox' ) [ 0 ] ;
111+ scrollBar = legend . getElementsByClassName ( 'scrollbar ' ) [ 0 ] ;
112+ toggle = legend . getElementsByClassName ( 'legendtoggle' ) [ 0 ] ;
105113
106114 legend . dispatchEvent ( scrollTo ( wheelDeltaY ) ) ;
107115
@@ -111,6 +119,8 @@ describe('The legend', function() {
111119 expect ( scrollBox . getAttribute ( 'data-scroll' ) ) . toBe ( dataScroll ) ;
112120 expect ( scrollBox . getAttribute ( 'transform' ) ) . toBe (
113121 'translate(0, ' + dataScroll + ')' ) ;
122+ expect ( scrollBar . getAttribute ( 'width' ) ) . toBeGreaterThan ( 0 ) ;
123+ expect ( scrollBar . getAttribute ( 'height' ) ) . toBeGreaterThan ( 0 ) ;
114124 } ) ;
115125
116126 it ( 'should constrain scrolling to the contents' , function ( ) {
0 commit comments