@@ -99,15 +99,15 @@ describe('The legend', function() {
9999 2 * constants . scrollBarMargin ;
100100 var initialDataScroll = getScroll ( gd ) ;
101101 var wheelDeltaY = 100 ;
102- var finalDataScroll = Lib . constrain ( initialDataScroll -
102+ var finalDataScroll = Lib . constrain ( initialDataScroll +
103103 wheelDeltaY / scrollBarYMax * scrollBoxYMax ,
104- - scrollBoxYMax , 0 ) ;
104+ 0 , scrollBoxYMax ) ;
105105
106106 legend . dispatchEvent ( scrollTo ( wheelDeltaY ) ) ;
107107
108108 expect ( getScroll ( gd ) ) . toBe ( finalDataScroll ) ;
109109 expect ( scrollBox . getAttribute ( 'transform' ) ) . toBe (
110- 'translate(0, ' + finalDataScroll + ')' ) ;
110+ 'translate(0, ' + - finalDataScroll + ')' ) ;
111111 } ) ;
112112
113113 function dragScroll ( element , rightClick ) {
@@ -120,9 +120,9 @@ describe('The legend', function() {
120120 2 * constants . scrollBarMargin ;
121121 var initialDataScroll = getScroll ( gd ) ;
122122 var dy = 50 ;
123- var finalDataScroll = Lib . constrain ( initialDataScroll -
123+ var finalDataScroll = Lib . constrain ( initialDataScroll +
124124 dy / scrollBarYMax * scrollBoxYMax ,
125- - scrollBoxYMax , 0 ) ;
125+ 0 , scrollBoxYMax ) ;
126126
127127 var y0 = scrollBarBB . top + scrollBarBB . height / 5 ;
128128 var y1 = y0 + dy ;
@@ -152,7 +152,7 @@ describe('The legend', function() {
152152 var dataScroll = getScroll ( gd ) ;
153153 expect ( dataScroll ) . toBeCloseTo ( finalDataScroll , 3 ) ;
154154 expect ( scrollBox . getAttribute ( 'transform' ) ) . toBe (
155- 'translate(0, ' + dataScroll + ')' ) ;
155+ 'translate(0, ' + - dataScroll + ')' ) ;
156156 } ) ;
157157
158158 it ( 'should not scroll on dragging the scrollbox' , function ( ) {
@@ -162,7 +162,7 @@ describe('The legend', function() {
162162 var dataScroll = getScroll ( gd ) ;
163163 expect ( dataScroll ) . not . toBeCloseTo ( finalDataScroll , 3 ) ;
164164 expect ( scrollBox . getAttribute ( 'transform' ) ) . toBe (
165- 'translate(0, ' + dataScroll + ')' ) ;
165+ 'translate(0, ' + - dataScroll + ')' ) ;
166166 } ) ;
167167
168168 it ( 'should not scroll on dragging the scrollbar with a right click' , function ( ) {
@@ -172,7 +172,7 @@ describe('The legend', function() {
172172 var dataScroll = getScroll ( gd ) ;
173173 expect ( dataScroll ) . not . toBeCloseTo ( finalDataScroll , 3 ) ;
174174 expect ( scrollBox . getAttribute ( 'transform' ) ) . toBe (
175- 'translate(0, ' + dataScroll + ')' ) ;
175+ 'translate(0, ' + - dataScroll + ')' ) ;
176176 } ) ;
177177
178178 it ( 'removes scroll bar and handlers when switching to horizontal' , function ( done ) {
@@ -214,15 +214,15 @@ describe('The legend', function() {
214214 expect ( scrollBarHeight1 ) . toBeGreaterThan ( scrollBarHeight ) ;
215215
216216 // we haven't quite removed the scrollbar, but we should have clipped the scroll value
217- return Plotly . deleteTraces ( gd , [ 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 ] ) ;
217+ return Plotly . deleteTraces ( gd , [ 0 , 1 , 2 , 3 , 4 , 5 , 6 ] ) ;
218218 } )
219219 . then ( function ( ) {
220- expect ( getScroll ( gd ) ) . toBeGreaterThan ( dataScroll + 1 ) ;
220+ expect ( getScroll ( gd ) ) . toBeLessThan ( dataScroll - 1 ) ;
221221 var scrollBarHeight2 = getScrollBar ( ) . getBoundingClientRect ( ) . height ;
222222 expect ( scrollBarHeight2 ) . toBeGreaterThan ( scrollBarHeight1 ) ;
223223
224224 // now no more scrollBar
225- return Plotly . deleteTraces ( gd , [ 0 , 1 ] ) ;
225+ return Plotly . deleteTraces ( gd , [ 0 , 1 , 2 ] ) ;
226226 } )
227227 . then ( function ( ) {
228228 expect ( hasScrollBar ( ) ) . toBe ( false ) ;
@@ -251,7 +251,7 @@ describe('The legend', function() {
251251 expect ( + toggle . parentNode . style . opacity ) . toBeLessThan ( 1 ) ;
252252 expect ( getScroll ( gd ) ) . toBe ( dataScroll ) ;
253253 expect ( scrollBox . getAttribute ( 'transform' ) ) . toBe (
254- 'translate(0, ' + dataScroll + ')' ) ;
254+ 'translate(0, ' + - dataScroll + ')' ) ;
255255 done ( ) ;
256256 } , DBLCLICKDELAY * 2 ) ;
257257 } ) ;
@@ -289,7 +289,7 @@ describe('The legend', function() {
289289 expect ( + toggle . parentNode . style . opacity ) . toBeLessThan ( 1 ) ;
290290 expect ( getScroll ( gd ) ) . toBe ( dataScroll ) ;
291291 expect ( scrollBox . getAttribute ( 'transform' ) ) . toBe (
292- 'translate(0, ' + dataScroll + ')' ) ;
292+ 'translate(0, ' + - dataScroll + ')' ) ;
293293 expect ( scrollBar . getAttribute ( 'width' ) ) . toBeGreaterThan ( 0 ) ;
294294 expect ( scrollBar . getAttribute ( 'height' ) ) . toBeGreaterThan ( 0 ) ;
295295 done ( ) ;
0 commit comments