@@ -1446,7 +1446,7 @@ describe('Test gl2d plots', function() {
1446
1446
var mock = require ( '@mocks/gl2d_10.json' ) ;
1447
1447
1448
1448
beforeEach ( function ( ) {
1449
- jasmine . DEFAULT_TIMEOUT_INTERVAL = 5000 ;
1449
+ jasmine . DEFAULT_TIMEOUT_INTERVAL = 10000 ;
1450
1450
gd = createGraphDiv ( ) ;
1451
1451
} ) ;
1452
1452
@@ -1462,6 +1462,26 @@ describe('Test gl2d plots', function() {
1462
1462
return drag ( node , dx , dy , null , p0 [ 0 ] , p0 [ 1 ] ) ;
1463
1463
}
1464
1464
1465
+ function select ( path ) {
1466
+ return new Promise ( function ( resolve ) {
1467
+ gd . once ( 'plotly_selected' , resolve ) ;
1468
+
1469
+ var len = path . length ;
1470
+
1471
+ // do selection
1472
+ Lib . clearThrottle ( ) ;
1473
+ mouseEvent ( 'mousemove' , path [ 0 ] [ 0 ] , path [ 0 ] [ 1 ] ) ;
1474
+ mouseEvent ( 'mousedown' , path [ 0 ] [ 0 ] , path [ 0 ] [ 1 ] ) ;
1475
+
1476
+ path . slice ( 1 , len ) . forEach ( function ( pt ) {
1477
+ Lib . clearThrottle ( ) ;
1478
+ mouseEvent ( 'mousemove' , pt [ 0 ] , pt [ 1 ] ) ;
1479
+ } ) ;
1480
+
1481
+ mouseEvent ( 'mouseup' , path [ len - 1 ] [ 0 ] , path [ len - 1 ] [ 1 ] ) ;
1482
+ } ) ;
1483
+ }
1484
+
1465
1485
it ( 'should respond to drag interactions' , function ( done ) {
1466
1486
var _mock = Lib . extendDeep ( { } , mock ) ;
1467
1487
@@ -1562,7 +1582,7 @@ describe('Test gl2d plots', function() {
1562
1582
. then ( done ) ;
1563
1583
} ) ;
1564
1584
1565
- it ( '@noCI should be able to toggle visibility' , function ( done ) {
1585
+ it ( 'should be able to toggle visibility' , function ( done ) {
1566
1586
var _mock = Lib . extendDeep ( { } , mock ) ;
1567
1587
1568
1588
Plotly . plot ( gd , _mock )
@@ -1592,6 +1612,34 @@ describe('Test gl2d plots', function() {
1592
1612
. then ( done ) ;
1593
1613
} ) ;
1594
1614
1615
+ it ( 'should display selection of big number of points' , function ( done ) {
1616
+ // generate large number of points
1617
+ var x = [ ] , y = [ ] ;
1618
+ for ( var i = 0 ; i < 2e4 ; i ++ ) {
1619
+ x . push ( Math . random ( ) ) ;
1620
+ y . push ( Math . random ( ) ) ;
1621
+ }
1622
+
1623
+ var mock = {
1624
+ data : [ {
1625
+ x : x , y : y , type : 'scattergl' , mode : 'markers'
1626
+ } ] ,
1627
+ layout : {
1628
+ dragmode : 'select'
1629
+ }
1630
+ } ;
1631
+
1632
+ Plotly . plot ( gd , mock )
1633
+ . then ( select ( [ [ 160 , 100 ] , [ 180 , 100 ] ] ) )
1634
+ . then ( function ( ) {
1635
+ expect ( readPixel ( gd . querySelector ( '.gl-canvas-context' ) , 168 , 100 ) [ 3 ] ) . toBe ( 0 ) ;
1636
+ expect ( readPixel ( gd . querySelector ( '.gl-canvas-context' ) , 158 , 100 ) [ 3 ] ) . not . toBe ( 0 ) ;
1637
+ expect ( readPixel ( gd . querySelector ( '.gl-canvas-focus' ) , 168 , 100 ) [ 3 ] ) . not . toBe ( 0 ) ;
1638
+ } )
1639
+ . catch ( fail )
1640
+ . then ( done ) ;
1641
+ } ) ;
1642
+
1595
1643
it ( 'should be able to toggle from svg to gl' , function ( done ) {
1596
1644
Plotly . plot ( gd , [ {
1597
1645
y : [ 1 , 2 , 1 ] ,
0 commit comments