@@ -161,7 +161,7 @@ describe('ModeBar', function() {
161161 it ( 'creates mode bar (cartesian version)' , function ( ) {
162162 var buttons = getButtons ( [
163163 [ 'toImage' , 'sendDataToCloud' ] ,
164- [ 'zoom2d' , 'pan2d' ] ,
164+ [ 'zoom2d' , 'pan2d' , 'select2d' , 'lasso2d' ] ,
165165 [ 'zoomIn2d' , 'zoomOut2d' , 'autoScale2d' , 'resetScale2d' ] ,
166166 [ 'hoverClosestCartesian' , 'hoverCompareCartesian' ]
167167 ] ) ;
@@ -175,13 +175,14 @@ describe('ModeBar', function() {
175175
176176 expect ( modeBar . hasButtons ( buttons ) ) . toBe ( true ) ;
177177 expect ( countGroups ( modeBar ) ) . toEqual ( 5 ) ;
178- expect ( countButtons ( modeBar ) ) . toEqual ( 11 ) ;
178+ expect ( countButtons ( modeBar ) ) . toEqual ( 13 ) ;
179179 expect ( countLogo ( modeBar ) ) . toEqual ( 1 ) ;
180180 } ) ;
181181
182182 it ( 'creates mode bar (cartesian fixed-axes version)' , function ( ) {
183183 var buttons = getButtons ( [
184184 [ 'toImage' , 'sendDataToCloud' ] ,
185+ [ 'select2d' , 'lasso2d' ] ,
185186 [ 'hoverClosestCartesian' , 'hoverCompareCartesian' ]
186187 ] ) ;
187188
@@ -192,8 +193,8 @@ describe('ModeBar', function() {
192193 var modeBar = gd . _fullLayout . _modeBar ;
193194
194195 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 ) ;
197198 expect ( countLogo ( modeBar ) ) . toEqual ( 1 ) ;
198199 } ) ;
199200
@@ -339,25 +340,32 @@ describe('ModeBar', function() {
339340 it ( 'updates mode bar buttons if modeBarButtonsToRemove changes' , function ( ) {
340341 var gd = setupGraphInfo ( ) ;
341342 manageModeBar ( gd ) ;
343+ var initialButtonCount = countButtons ( gd . _fullLayout . _modeBar ) ;
342344
343345 gd . _context . modeBarButtonsToRemove = [ 'toImage' , 'sendDataToCloud' ] ;
344346 manageModeBar ( gd ) ;
345347
346- expect ( countButtons ( gd . _fullLayout . _modeBar ) ) . toEqual ( 9 ) ;
348+ expect ( countButtons ( gd . _fullLayout . _modeBar ) )
349+ . toEqual ( initialButtonCount - 2 ) ;
347350 } ) ;
348351
349352 it ( 'updates mode bar buttons if modeBarButtonsToAdd changes' , function ( ) {
350353 var gd = setupGraphInfo ( ) ;
351354 manageModeBar ( gd ) ;
352355
356+ var initialGroupCount = countGroups ( gd . _fullLayout . _modeBar ) ,
357+ initialButtonCount = countButtons ( gd . _fullLayout . _modeBar ) ;
358+
353359 gd . _context . modeBarButtonsToAdd = [ {
354360 name : 'some button' ,
355361 click : noop
356362 } ] ;
357363 manageModeBar ( gd ) ;
358364
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 ) ;
361369 } ) ;
362370
363371 it ( 'sets up buttons with modeBarButtonsToAdd and modeBarButtonToRemove' , function ( ) {
@@ -374,7 +382,7 @@ describe('ModeBar', function() {
374382
375383 var modeBar = gd . _fullLayout . _modeBar ;
376384 expect ( countGroups ( modeBar ) ) . toEqual ( 6 ) ;
377- expect ( countButtons ( modeBar ) ) . toEqual ( 10 ) ;
385+ expect ( countButtons ( modeBar ) ) . toEqual ( 12 ) ;
378386 } ) ;
379387
380388 it ( 'sets up buttons with modeBarButtonsToAdd and modeBarButtonToRemove (2)' , function ( ) {
@@ -394,7 +402,7 @@ describe('ModeBar', function() {
394402
395403 var modeBar = gd . _fullLayout . _modeBar ;
396404 expect ( countGroups ( modeBar ) ) . toEqual ( 7 ) ;
397- expect ( countButtons ( modeBar ) ) . toEqual ( 12 ) ;
405+ expect ( countButtons ( modeBar ) ) . toEqual ( 14 ) ;
398406 } ) ;
399407
400408 it ( 'sets up buttons with fully custom modeBarButtons' , function ( ) {
0 commit comments