@@ -94,14 +94,22 @@ describe('The legend', function() {
94
94
'translate(0, ' + dataScroll + ')' ) ;
95
95
} ) ;
96
96
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
+
98
106
Plotly . relayout ( gd , 'showlegend' , false ) ;
99
107
Plotly . relayout ( gd , 'showlegend' , true ) ;
100
108
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 ] ;
105
113
106
114
legend . dispatchEvent ( scrollTo ( wheelDeltaY ) ) ;
107
115
@@ -111,6 +119,8 @@ describe('The legend', function() {
111
119
expect ( scrollBox . getAttribute ( 'data-scroll' ) ) . toBe ( dataScroll ) ;
112
120
expect ( scrollBox . getAttribute ( 'transform' ) ) . toBe (
113
121
'translate(0, ' + dataScroll + ')' ) ;
122
+ expect ( scrollBar . getAttribute ( 'width' ) ) . toBeGreaterThan ( 0 ) ;
123
+ expect ( scrollBar . getAttribute ( 'height' ) ) . toBeGreaterThan ( 0 ) ;
114
124
} ) ;
115
125
116
126
it ( 'should constrain scrolling to the contents' , function ( ) {
0 commit comments