File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -79,6 +79,21 @@ describe('The legend', function() {
79
79
'translate(0, ' + finalDataScroll + ')' ) ;
80
80
} ) ;
81
81
82
+ it ( 'should keep the scrollbar position after a toggle event' , function ( ) {
83
+ var scrollBox = legend . getElementsByClassName ( 'scrollbox' ) [ 0 ] ,
84
+ toggle = legend . getElementsByClassName ( 'legendtoggle' ) [ 0 ] ,
85
+ wheelDeltaY = 100 ;
86
+
87
+ legend . dispatchEvent ( scrollTo ( wheelDeltaY ) ) ;
88
+ var dataScroll = scrollBox . getAttribute ( 'data-scroll' ) ;
89
+
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
+ } ) ;
96
+
82
97
it ( 'should constrain scrolling to the contents' , function ( ) {
83
98
var scrollBox = legend . getElementsByClassName ( 'scrollbox' ) [ 0 ] ;
84
99
You can’t perform that action at this time.
0 commit comments