@@ -99,15 +99,15 @@ describe('The legend', function() {
99
99
2 * constants . scrollBarMargin ;
100
100
var initialDataScroll = getScroll ( gd ) ;
101
101
var wheelDeltaY = 100 ;
102
- var finalDataScroll = Lib . constrain ( initialDataScroll -
102
+ var finalDataScroll = Lib . constrain ( initialDataScroll +
103
103
wheelDeltaY / scrollBarYMax * scrollBoxYMax ,
104
- - scrollBoxYMax , 0 ) ;
104
+ 0 , scrollBoxYMax ) ;
105
105
106
106
legend . dispatchEvent ( scrollTo ( wheelDeltaY ) ) ;
107
107
108
108
expect ( getScroll ( gd ) ) . toBe ( finalDataScroll ) ;
109
109
expect ( scrollBox . getAttribute ( 'transform' ) ) . toBe (
110
- 'translate(0, ' + finalDataScroll + ')' ) ;
110
+ 'translate(0, ' + - finalDataScroll + ')' ) ;
111
111
} ) ;
112
112
113
113
function dragScroll ( element , rightClick ) {
@@ -120,9 +120,9 @@ describe('The legend', function() {
120
120
2 * constants . scrollBarMargin ;
121
121
var initialDataScroll = getScroll ( gd ) ;
122
122
var dy = 50 ;
123
- var finalDataScroll = Lib . constrain ( initialDataScroll -
123
+ var finalDataScroll = Lib . constrain ( initialDataScroll +
124
124
dy / scrollBarYMax * scrollBoxYMax ,
125
- - scrollBoxYMax , 0 ) ;
125
+ 0 , scrollBoxYMax ) ;
126
126
127
127
var y0 = scrollBarBB . top + scrollBarBB . height / 5 ;
128
128
var y1 = y0 + dy ;
@@ -152,7 +152,7 @@ describe('The legend', function() {
152
152
var dataScroll = getScroll ( gd ) ;
153
153
expect ( dataScroll ) . toBeCloseTo ( finalDataScroll , 3 ) ;
154
154
expect ( scrollBox . getAttribute ( 'transform' ) ) . toBe (
155
- 'translate(0, ' + dataScroll + ')' ) ;
155
+ 'translate(0, ' + - dataScroll + ')' ) ;
156
156
} ) ;
157
157
158
158
it ( 'should not scroll on dragging the scrollbox' , function ( ) {
@@ -162,7 +162,7 @@ describe('The legend', function() {
162
162
var dataScroll = getScroll ( gd ) ;
163
163
expect ( dataScroll ) . not . toBeCloseTo ( finalDataScroll , 3 ) ;
164
164
expect ( scrollBox . getAttribute ( 'transform' ) ) . toBe (
165
- 'translate(0, ' + dataScroll + ')' ) ;
165
+ 'translate(0, ' + - dataScroll + ')' ) ;
166
166
} ) ;
167
167
168
168
it ( 'should not scroll on dragging the scrollbar with a right click' , function ( ) {
@@ -172,7 +172,7 @@ describe('The legend', function() {
172
172
var dataScroll = getScroll ( gd ) ;
173
173
expect ( dataScroll ) . not . toBeCloseTo ( finalDataScroll , 3 ) ;
174
174
expect ( scrollBox . getAttribute ( 'transform' ) ) . toBe (
175
- 'translate(0, ' + dataScroll + ')' ) ;
175
+ 'translate(0, ' + - dataScroll + ')' ) ;
176
176
} ) ;
177
177
178
178
it ( 'removes scroll bar and handlers when switching to horizontal' , function ( done ) {
@@ -214,15 +214,15 @@ describe('The legend', function() {
214
214
expect ( scrollBarHeight1 ) . toBeGreaterThan ( scrollBarHeight ) ;
215
215
216
216
// 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 ] ) ;
218
218
} )
219
219
. then ( function ( ) {
220
- expect ( getScroll ( gd ) ) . toBeGreaterThan ( dataScroll + 1 ) ;
220
+ expect ( getScroll ( gd ) ) . toBeLessThan ( dataScroll - 1 ) ;
221
221
var scrollBarHeight2 = getScrollBar ( ) . getBoundingClientRect ( ) . height ;
222
222
expect ( scrollBarHeight2 ) . toBeGreaterThan ( scrollBarHeight1 ) ;
223
223
224
224
// now no more scrollBar
225
- return Plotly . deleteTraces ( gd , [ 0 , 1 ] ) ;
225
+ return Plotly . deleteTraces ( gd , [ 0 , 1 , 2 ] ) ;
226
226
} )
227
227
. then ( function ( ) {
228
228
expect ( hasScrollBar ( ) ) . toBe ( false ) ;
@@ -251,7 +251,7 @@ describe('The legend', function() {
251
251
expect ( + toggle . parentNode . style . opacity ) . toBeLessThan ( 1 ) ;
252
252
expect ( getScroll ( gd ) ) . toBe ( dataScroll ) ;
253
253
expect ( scrollBox . getAttribute ( 'transform' ) ) . toBe (
254
- 'translate(0, ' + dataScroll + ')' ) ;
254
+ 'translate(0, ' + - dataScroll + ')' ) ;
255
255
done ( ) ;
256
256
} , DBLCLICKDELAY * 2 ) ;
257
257
} ) ;
@@ -289,7 +289,7 @@ describe('The legend', function() {
289
289
expect ( + toggle . parentNode . style . opacity ) . toBeLessThan ( 1 ) ;
290
290
expect ( getScroll ( gd ) ) . toBe ( dataScroll ) ;
291
291
expect ( scrollBox . getAttribute ( 'transform' ) ) . toBe (
292
- 'translate(0, ' + dataScroll + ')' ) ;
292
+ 'translate(0, ' + - dataScroll + ')' ) ;
293
293
expect ( scrollBar . getAttribute ( 'width' ) ) . toBeGreaterThan ( 0 ) ;
294
294
expect ( scrollBar . getAttribute ( 'height' ) ) . toBeGreaterThan ( 0 ) ;
295
295
done ( ) ;
0 commit comments