@@ -1228,6 +1228,90 @@ describe('Test select box and lasso in general:', function() {
12281228 . then ( done ) ;
12291229 } ) ;
12301230
1231+ describe ( 'should return correct range data on dragmode *select*' , function ( ) {
1232+ var specs = [ {
1233+ axType : 'linear' ,
1234+ rng : [ - 0.6208 , 0.8375 ]
1235+ } , {
1236+ axType : 'log' ,
1237+ rng : [ 0.2394 , 6.8785 ]
1238+ } , {
1239+ axType : 'date' ,
1240+ rng : [ '2000-01-20 19:48' , '2000-04-06 01:48' ]
1241+ } , {
1242+ axType : 'category' ,
1243+ rng : [ - 0.6208 , 0.8375 ]
1244+ } , {
1245+ axType : 'multicategory' ,
1246+ rng : [ - 0.6208 , 0.8375 ]
1247+ } ] ;
1248+
1249+ specs . forEach ( function ( s ) {
1250+ it ( '- @flaky on ' + s . axType + ' axes' , function ( done ) {
1251+ var gd = createGraphDiv ( ) ;
1252+
1253+ Plotly . plot ( gd , [ ] , {
1254+ xaxis : { type : s . axType } ,
1255+ dragmode : 'select' ,
1256+ width : 400 ,
1257+ height : 400
1258+ } )
1259+ . then ( function ( ) {
1260+ resetEvents ( gd ) ;
1261+ drag ( selectPath ) ;
1262+ return selectedPromise ;
1263+ } )
1264+ . then ( function ( ) {
1265+ expect ( selectedData . range . x ) . toBeCloseToArray ( s . rng , 2 ) ;
1266+ } )
1267+ . catch ( failTest )
1268+ . then ( done ) ;
1269+ } ) ;
1270+ } ) ;
1271+ } ) ;
1272+
1273+ describe ( 'should return correct range data on dragmode *lasso*' , function ( ) {
1274+ var specs = [ {
1275+ axType : 'linear' ,
1276+ pts : [ 5.883 , 5.941 , 6 , 6 ]
1277+ } , {
1278+ axType : 'log' ,
1279+ pts : [ 764422.2742 , 874312.4580 , 1000000 , 1000000 ]
1280+ } , {
1281+ axType : 'date' ,
1282+ pts : [ '2000-12-25 21:36' , '2000-12-28 22:48' , '2001-01-01' , '2001-01-01' ]
1283+ } , {
1284+ axType : 'category' ,
1285+ pts : [ 5.8833 , 5.9416 , 6 , 6 ]
1286+ } , {
1287+ axType : 'multicategory' ,
1288+ pts : [ 5.8833 , 5.9416 , 6 , 6 ]
1289+ } ] ;
1290+
1291+ specs . forEach ( function ( s ) {
1292+ it ( '- @flaky on ' + s . axType + ' axes' , function ( done ) {
1293+ var gd = createGraphDiv ( ) ;
1294+
1295+ Plotly . plot ( gd , [ ] , {
1296+ xaxis : { type : s . axType } ,
1297+ dragmode : 'lasso' ,
1298+ width : 400 ,
1299+ height : 400
1300+ } )
1301+ . then ( function ( ) {
1302+ resetEvents ( gd ) ;
1303+ drag ( lassoPath ) ;
1304+ return selectedPromise ;
1305+ } )
1306+ . then ( function ( ) {
1307+ expect ( selectedData . lassoPoints . x ) . toBeCloseToArray ( s . pts , 2 ) ;
1308+ } )
1309+ . catch ( failTest )
1310+ . then ( done ) ;
1311+ } ) ;
1312+ } ) ;
1313+ } ) ;
1314+
12311315 it ( '@flaky should have their selection outlines cleared during *axrange* relayout calls' , function ( done ) {
12321316 var gd = createGraphDiv ( ) ;
12331317 var fig = Lib . extendDeep ( { } , mock ) ;
0 commit comments