@@ -30,7 +30,7 @@ function _newPlot(gd, arg2, arg3, arg4) {
3030 if ( ! fig . layout ) fig . layout = { } ;
3131 if ( ! fig . layout . newselection ) fig . layout . newselection = { } ;
3232 fig . layout . newselection . mode = 'gradual' ;
33- // complex ouline creation are mainly tested in " gradual" mode here
33+ // complex ouline creation are mainly tested in ' gradual' mode here
3434
3535 return Plotly . newPlot ( gd , fig ) ;
3636}
@@ -3030,6 +3030,67 @@ describe('Test select box and lasso per trace:', function() {
30303030 . then ( done , done . fail ) ;
30313031 } ) ;
30323032 } ) ;
3033+
3034+ it ( '@gl should work on choroplethmapbox traces after adding a new trace on top:' , function ( done ) {
3035+ var assertPoints = makeAssertPoints ( [ 'location' , 'z' ] ) ;
3036+ var assertRanges = makeAssertRanges ( 'mapbox' ) ;
3037+ var assertLassoPoints = makeAssertLassoPoints ( 'mapbox' ) ;
3038+ var assertSelectedPoints = makeAssertSelectedPoints ( ) ;
3039+
3040+ var fig = Lib . extendDeep ( { } , require ( '@mocks/mapbox_choropleth0.json' ) ) ;
3041+
3042+ fig . data [ 0 ] . locations . push ( null ) ;
3043+
3044+ fig . layout . dragmode = 'select' ;
3045+ fig . config = {
3046+ mapboxAccessToken : require ( '@build/credentials.json' ) . MAPBOX_ACCESS_TOKEN
3047+ } ;
3048+ addInvisible ( fig ) ;
3049+
3050+ var hasCssTransform = false ;
3051+
3052+ _newPlot ( gd , fig )
3053+ . then ( function ( ) {
3054+ // add a scatter points on top
3055+ fig . data [ 3 ] = {
3056+ type : 'scattermapbox' ,
3057+ marker : { size : 40 } ,
3058+ lon : [ - 70 ] ,
3059+ lat : [ 40 ]
3060+ } ;
3061+
3062+ return Plotly . react ( gd , fig ) ;
3063+ } )
3064+ . then ( function ( ) {
3065+ return _run ( hasCssTransform ,
3066+ [ [ 150 , 150 ] , [ 300 , 300 ] ] ,
3067+ function ( ) {
3068+ assertPoints ( [ [ 'NY' , 10 ] ] ) ;
3069+ assertRanges ( [ [ - 83.38 , 46.13 ] , [ - 74.06 , 39.29 ] ] ) ;
3070+ assertSelectedPoints ( { 0 : [ 0 ] , 3 : [ ] } ) ;
3071+ } ,
3072+ null , BOXEVENTS , 'choroplethmapbox select'
3073+ ) ;
3074+ } )
3075+ . then ( function ( ) {
3076+ return Plotly . relayout ( gd , 'dragmode' , 'lasso' ) ;
3077+ } )
3078+ . then ( function ( ) {
3079+ return _run ( hasCssTransform ,
3080+ [ [ 300 , 200 ] , [ 300 , 300 ] , [ 400 , 300 ] , [ 400 , 200 ] , [ 300 , 200 ] ] ,
3081+ function ( ) {
3082+ assertPoints ( [ [ 'MA' , 20 ] , [ ] ] ) ;
3083+ assertSelectedPoints ( { 0 : [ 1 ] , 3 : [ 0 ] } ) ;
3084+ assertLassoPoints ( [
3085+ [ - 74.06 , 43.936 ] , [ - 74.06 , 39.293 ] , [ - 67.84 , 39.293 ] ,
3086+ [ - 67.84 , 43.936 ] , [ - 74.06 , 43.936 ]
3087+ ] ) ;
3088+ } ,
3089+ null , LASSOEVENTS , 'choroplethmapbox lasso'
3090+ ) ;
3091+ } )
3092+ . then ( done , done . fail ) ;
3093+ } , LONG_TIMEOUT_INTERVAL ) ;
30333094} ) ;
30343095
30353096describe ( 'Test that selections persist:' , function ( ) {
0 commit comments