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() {
85
85
wheelDeltaY = 100 ;
86
86
87
87
legend . dispatchEvent ( scrollTo ( wheelDeltaY ) ) ;
88
+
88
89
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
+ } ) ;
89
96
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' ) ;
90
109
toggle . dispatchEvent ( new MouseEvent ( 'click' ) ) ;
91
110
expect ( + toggle . parentNode . style . opacity ) . toBeLessThan ( 1 ) ;
92
111
expect ( scrollBox . getAttribute ( 'data-scroll' ) ) . toBe ( dataScroll ) ;
You can’t perform that action at this time.
0 commit comments