@@ -866,11 +866,11 @@ describe('@noCI, mapbox plots', function() {
866866 it ( 'should respond drag / scroll / double-click interactions' , function ( done ) {
867867 var relayoutCnt = 0 ;
868868 var doubleClickCnt = 0 ;
869- var updateData ;
869+ var evtData ;
870870
871- gd . on ( 'plotly_relayout' , function ( eventData ) {
871+ gd . on ( 'plotly_relayout' , function ( d ) {
872872 relayoutCnt ++ ;
873- updateData = eventData ;
873+ evtData = d ;
874874 } ) ;
875875
876876 gd . on ( 'plotly_doubleclick' , function ( ) {
@@ -885,42 +885,46 @@ describe('@noCI, mapbox plots', function() {
885885 } ) ;
886886 }
887887
888- function assertLayout ( center , zoom , opts ) {
889- var mapInfo = getMapInfo ( gd ) ,
890- layout = gd . layout . mapbox ;
888+ function _assertLayout ( center , zoom ) {
889+ var mapInfo = getMapInfo ( gd ) ;
890+ var layout = gd . layout . mapbox ;
891891
892892 expect ( [ mapInfo . center . lng , mapInfo . center . lat ] ) . toBeCloseToArray ( center ) ;
893893 expect ( mapInfo . zoom ) . toBeCloseTo ( zoom ) ;
894894
895895 expect ( [ layout . center . lon , layout . center . lat ] ) . toBeCloseToArray ( center ) ;
896896 expect ( layout . zoom ) . toBeCloseTo ( zoom ) ;
897+ }
897898
898- if ( opts && opts . withUpdateData ) {
899+ function _assert ( center , zoom ) {
900+ _assertLayout ( center , zoom ) ;
899901
900902 expect ( [ evtData [ 'mapbox.center' ] . lon , evtData [ 'mapbox.center' ] . lat ] ) . toBeCloseToArray ( center ) ;
901903 expect ( evtData [ 'mapbox.zoom' ] ) . toBeCloseTo ( zoom ) ;
902- }
903904 }
904905
905- assertLayout ( [ - 4.710 , 19.475 ] , 1.234 ) ;
906+ _assertLayout ( [ - 4.710 , 19.475 ] , 1.234 ) ;
906907
907908 var p1 = [ pointPos [ 0 ] + 50 , pointPos [ 1 ] - 20 ] ;
908909
909910 _drag ( pointPos , p1 , function ( ) {
910- expect ( relayoutCnt ) . toEqual ( 1 ) ;
911- assertLayout ( [ - 19.651 , 13.751 ] , 1.234 , { withUpdateData : true } ) ;
911+ expect ( relayoutCnt ) . toBe ( 1 , 'relayout cnt' ) ;
912+ expect ( doubleClickCnt ) . toBe ( 0 , 'double click cnt' ) ;
913+ _assert ( [ - 19.651 , 13.751 ] , 1.234 ) ;
912914
913915 return _doubleClick ( p1 ) ;
914916 } )
915917 . then ( function ( ) {
918+ expect ( relayoutCnt ) . toBe ( 2 , 'relayout cnt' ) ;
916919 expect ( doubleClickCnt ) . toBe ( 1 , 'double click cnt' ) ;
917- assertLayout ( [ - 4.710 , 19.475 ] , 1.234 ) ;
920+ _assert ( [ - 4.710 , 19.475 ] , 1.234 ) ;
918921
919922 return _scroll ( pointPos ) ;
920923 } )
921924 . then ( function ( ) {
925+ expect ( relayoutCnt ) . toBe ( 3 , 'relayout cnt' ) ;
926+ expect ( doubleClickCnt ) . toBe ( 1 , 'double click cnt' ) ;
922927 expect ( getMapInfo ( gd ) . zoom ) . toBeGreaterThan ( 1.234 ) ;
923- expect ( relayoutCnt ) . toBe ( 2 ) ;
924928 } )
925929 . catch ( failTest )
926930 . then ( done ) ;
0 commit comments