@@ -30,7 +30,7 @@ function _newPlot(gd, arg2, arg3, arg4) {
30
30
if ( ! fig . layout ) fig . layout = { } ;
31
31
if ( ! fig . layout . newselection ) fig . layout . newselection = { } ;
32
32
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
34
34
35
35
return Plotly . newPlot ( gd , fig ) ;
36
36
}
@@ -3030,6 +3030,67 @@ describe('Test select box and lasso per trace:', function() {
3030
3030
. then ( done , done . fail ) ;
3031
3031
} ) ;
3032
3032
} ) ;
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 ) ;
3033
3094
} ) ;
3034
3095
3035
3096
describe ( 'Test that selections persist:' , function ( ) {
0 commit comments