@@ -161,7 +161,7 @@ describe('ModeBar', function() {
161
161
it ( 'creates mode bar (cartesian version)' , function ( ) {
162
162
var buttons = getButtons ( [
163
163
[ 'toImage' , 'sendDataToCloud' ] ,
164
- [ 'zoom2d' , 'pan2d' ] ,
164
+ [ 'zoom2d' , 'pan2d' , 'select2d' , 'lasso2d' ] ,
165
165
[ 'zoomIn2d' , 'zoomOut2d' , 'autoScale2d' , 'resetScale2d' ] ,
166
166
[ 'hoverClosestCartesian' , 'hoverCompareCartesian' ]
167
167
] ) ;
@@ -175,13 +175,14 @@ describe('ModeBar', function() {
175
175
176
176
expect ( modeBar . hasButtons ( buttons ) ) . toBe ( true ) ;
177
177
expect ( countGroups ( modeBar ) ) . toEqual ( 5 ) ;
178
- expect ( countButtons ( modeBar ) ) . toEqual ( 11 ) ;
178
+ expect ( countButtons ( modeBar ) ) . toEqual ( 13 ) ;
179
179
expect ( countLogo ( modeBar ) ) . toEqual ( 1 ) ;
180
180
} ) ;
181
181
182
182
it ( 'creates mode bar (cartesian fixed-axes version)' , function ( ) {
183
183
var buttons = getButtons ( [
184
184
[ 'toImage' , 'sendDataToCloud' ] ,
185
+ [ 'select2d' , 'lasso2d' ] ,
185
186
[ 'hoverClosestCartesian' , 'hoverCompareCartesian' ]
186
187
] ) ;
187
188
@@ -192,8 +193,8 @@ describe('ModeBar', function() {
192
193
var modeBar = gd . _fullLayout . _modeBar ;
193
194
194
195
expect ( modeBar . hasButtons ( buttons ) ) . toBe ( true ) ;
195
- expect ( countGroups ( modeBar ) ) . toEqual ( 3 ) ;
196
- expect ( countButtons ( modeBar ) ) . toEqual ( 5 ) ;
196
+ expect ( countGroups ( modeBar ) ) . toEqual ( 4 ) ;
197
+ expect ( countButtons ( modeBar ) ) . toEqual ( 7 ) ;
197
198
expect ( countLogo ( modeBar ) ) . toEqual ( 1 ) ;
198
199
} ) ;
199
200
@@ -339,25 +340,32 @@ describe('ModeBar', function() {
339
340
it ( 'updates mode bar buttons if modeBarButtonsToRemove changes' , function ( ) {
340
341
var gd = setupGraphInfo ( ) ;
341
342
manageModeBar ( gd ) ;
343
+ var initialButtonCount = countButtons ( gd . _fullLayout . _modeBar ) ;
342
344
343
345
gd . _context . modeBarButtonsToRemove = [ 'toImage' , 'sendDataToCloud' ] ;
344
346
manageModeBar ( gd ) ;
345
347
346
- expect ( countButtons ( gd . _fullLayout . _modeBar ) ) . toEqual ( 9 ) ;
348
+ expect ( countButtons ( gd . _fullLayout . _modeBar ) )
349
+ . toEqual ( initialButtonCount - 2 ) ;
347
350
} ) ;
348
351
349
352
it ( 'updates mode bar buttons if modeBarButtonsToAdd changes' , function ( ) {
350
353
var gd = setupGraphInfo ( ) ;
351
354
manageModeBar ( gd ) ;
352
355
356
+ var initialGroupCount = countGroups ( gd . _fullLayout . _modeBar ) ,
357
+ initialButtonCount = countButtons ( gd . _fullLayout . _modeBar ) ;
358
+
353
359
gd . _context . modeBarButtonsToAdd = [ {
354
360
name : 'some button' ,
355
361
click : noop
356
362
} ] ;
357
363
manageModeBar ( gd ) ;
358
364
359
- expect ( countGroups ( gd . _fullLayout . _modeBar ) ) . toEqual ( 6 ) ;
360
- expect ( countButtons ( gd . _fullLayout . _modeBar ) ) . toEqual ( 12 ) ;
365
+ expect ( countGroups ( gd . _fullLayout . _modeBar ) )
366
+ . toEqual ( initialGroupCount + 1 ) ;
367
+ expect ( countButtons ( gd . _fullLayout . _modeBar ) )
368
+ . toEqual ( initialButtonCount + 1 ) ;
361
369
} ) ;
362
370
363
371
it ( 'sets up buttons with modeBarButtonsToAdd and modeBarButtonToRemove' , function ( ) {
@@ -374,7 +382,7 @@ describe('ModeBar', function() {
374
382
375
383
var modeBar = gd . _fullLayout . _modeBar ;
376
384
expect ( countGroups ( modeBar ) ) . toEqual ( 6 ) ;
377
- expect ( countButtons ( modeBar ) ) . toEqual ( 10 ) ;
385
+ expect ( countButtons ( modeBar ) ) . toEqual ( 12 ) ;
378
386
} ) ;
379
387
380
388
it ( 'sets up buttons with modeBarButtonsToAdd and modeBarButtonToRemove (2)' , function ( ) {
@@ -394,7 +402,7 @@ describe('ModeBar', function() {
394
402
395
403
var modeBar = gd . _fullLayout . _modeBar ;
396
404
expect ( countGroups ( modeBar ) ) . toEqual ( 7 ) ;
397
- expect ( countButtons ( modeBar ) ) . toEqual ( 12 ) ;
405
+ expect ( countButtons ( modeBar ) ) . toEqual ( 14 ) ;
398
406
} ) ;
399
407
400
408
it ( 'sets up buttons with fully custom modeBarButtons' , function ( ) {
0 commit comments