@@ -1600,100 +1600,100 @@ describe('Test select box and lasso in general:', function() {
1600
1600
. then ( done , done . fail ) ;
1601
1601
} ) ;
1602
1602
1603
- it ( 'should re-select data in all overlaying visible traces' , function ( done ) {
1603
+ it ( 'should re-select data in all overlaying visible traces' , function ( done ) {
1604
1604
var gd = createGraphDiv ( ) ;
1605
- _newPlot ( gd ,
1606
- [ {
1607
- x : [ 1 , 2 , 3 ] ,
1608
- y : [ 4 , 5 , 6 ] ,
1609
- name : "yaxis1 data" ,
1610
- type : "scatter"
1611
- } ,
1612
- {
1613
- x : [ 2 , 3 , 4 ] ,
1614
- y : [ 40 , 50 , 60 ] ,
1615
- name : "yaxis2 data" ,
1616
- yaxis : "y2" ,
1617
- xaxis : "x2" ,
1618
- type : "scatter"
1619
- } ,
1620
- {
1621
- x : [ 3 , 4 , 5 ] ,
1622
- y : [ 400 , 500 , 600 ] ,
1623
- name : "yaxis3 data" ,
1624
- yaxis : "y3" ,
1625
- type : "scatter"
1626
- } ,
1605
+ _newPlot ( gd , [ {
1606
+ x : [ 1 , 2 , 3 ] ,
1607
+ y : [ 4 , 5 , 6 ] ,
1608
+ name : 'yaxis1 data' ,
1609
+ type : 'scatter'
1610
+ } ,
1611
+ {
1612
+ x : [ 2 , 3 , 4 ] ,
1613
+ y : [ 40 , 50 , 60 ] ,
1614
+ name : 'yaxis2 data' ,
1615
+ yaxis : 'y2' ,
1616
+ xaxis : 'x2' ,
1617
+ type : 'scatter'
1618
+ } ,
1619
+ {
1620
+ x : [ 3 , 4 , 5 ] ,
1621
+ y : [ 400 , 500 , 600 ] ,
1622
+ name : 'yaxis3 data' ,
1623
+ yaxis : 'y3' ,
1624
+ type : 'scatter'
1625
+ } ,
1626
+ {
1627
+ x : [ 4 , 5 , 6 ] ,
1628
+ y : [ 1000 , 2000 , 3000 ] ,
1629
+ name : 'yaxis4 data' ,
1630
+ yaxis : 'y4' ,
1631
+ xaxis : 'x2' ,
1632
+ type : 'scatter'
1633
+ }
1634
+ ] ,
1627
1635
{
1628
- x : [ 4 , 5 , 6 ] ,
1629
- y : [ 1000 , 2000 , 3000 ] ,
1630
- name : "yaxis4 data" ,
1631
- yaxis : "y4" ,
1632
- xaxis : "x2" ,
1633
- type : "scatter"
1634
- }
1635
- ] , {
1636
- grid : {
1637
- rows : 2 ,
1638
- columns : 1 ,
1639
- pattern : "independent"
1640
- } ,
1641
- width : 800 ,
1642
- height : 800 ,
1643
- yaxis : {
1644
- showline : true ,
1645
- title : {
1646
- text : "yaxis title"
1647
- }
1648
- } ,
1649
- yaxis2 : {
1650
- title : {
1651
- text : "yaxis2 title"
1636
+ grid : {
1637
+ rows : 2 ,
1638
+ columns : 1 ,
1639
+ pattern : 'independent'
1652
1640
} ,
1653
- showline : true
1654
- } ,
1655
- yaxis3 : {
1656
- title : {
1657
- text : "yaxis3 title"
1641
+ width : 800 ,
1642
+ height : 800 ,
1643
+ yaxis : {
1644
+ showline : true ,
1645
+ title : {
1646
+ text : 'yaxis title'
1647
+ }
1658
1648
} ,
1659
- anchor : "free" ,
1660
- overlaying : "y" ,
1661
- showline : true ,
1662
- autoshift : true
1663
- } ,
1664
- yaxis4 : {
1665
- title : {
1666
- text : "yaxis4 title"
1649
+ yaxis2 : {
1650
+ title : {
1651
+ text : 'yaxis2 title'
1652
+ } ,
1653
+ showline : true
1667
1654
} ,
1668
- anchor : "free" ,
1669
- overlaying : "y2" ,
1670
- showline : true ,
1671
- autoshift : true
1672
- }
1673
- } ) . then ( function ( ) {
1674
- return Plotly . relayout ( gd , 'dragmode' , 'select' ) ;
1675
- } ) . then ( function ( ) {
1676
- return drag ( [ [ 150 , 100 ] , [ 600 , 250 ] ] ) ;
1677
- } ) . then ( function ( ) {
1678
- expect ( gd . data [ 0 ] . selectedpoints ) . toEqual ( [ 1 , 2 ] ) ;
1679
- expect ( gd . data [ 1 ] . selectedpoints ) . toBe ( undefined ) ;
1680
- expect ( gd . data [ 2 ] . selectedpoints ) . toEqual ( [ 1 ] ) ;
1681
- expect ( gd . data [ 3 ] . selectedpoints ) . toBe ( undefined ) ;
1682
- } ) . then ( function ( ) {
1683
- return drag ( [ [ 600 , 175 ] , [ 780 , 175 ] ] ) ; // Extend existing selection
1684
- } ) . then ( function ( ) {
1685
- expect ( gd . data [ 0 ] . selectedpoints ) . toEqual ( [ 1 , 2 ] ) ;
1686
- expect ( gd . data [ 1 ] . selectedpoints ) . toBe ( undefined ) ;
1687
- expect ( gd . data [ 2 ] . selectedpoints ) . toEqual ( [ 1 , 2 ] ) ;
1688
- expect ( gd . data [ 3 ] . selectedpoints ) . toBe ( undefined ) ;
1689
- } ) . then ( function ( ) {
1690
- return drag ( [ [ 150 , 600 ] , [ 780 , 300 ] ] ) ;
1691
- } ) . then ( function ( ) {
1692
- expect ( gd . data [ 0 ] . selectedpoints ) . toEqual ( [ 1 , 2 ] ) ;
1693
- expect ( gd . data [ 1 ] . selectedpoints ) . toEqual ( [ 1 , 2 ] ) ;
1694
- expect ( gd . data [ 2 ] . selectedpoints ) . toEqual ( [ 1 ] ) ;
1695
- expect ( gd . data [ 3 ] . selectedpoints ) . toEqual ( [ 1 , 2 ] ) ;
1696
- } ) . then ( done , done . fail ) ;
1655
+ yaxis3 : {
1656
+ title : {
1657
+ text : 'yaxis3 title'
1658
+ } ,
1659
+ anchor : 'free' ,
1660
+ overlaying : 'y' ,
1661
+ showline : true ,
1662
+ autoshift : true
1663
+ } ,
1664
+ yaxis4 : {
1665
+ title : {
1666
+ text : 'yaxis4 title'
1667
+ } ,
1668
+ anchor : 'free' ,
1669
+ overlaying : 'y2' ,
1670
+ showline : true ,
1671
+ autoshift : true
1672
+ }
1673
+ } ) . then ( function ( ) {
1674
+ return Plotly . relayout ( gd , 'dragmode' , 'select' ) ;
1675
+ } ) . then ( function ( ) {
1676
+ return drag ( [ [ 150 , 100 ] , [ 600 , 250 ] ] ) ;
1677
+ } ) . then ( function ( ) {
1678
+ expect ( gd . data [ 0 ] . selectedpoints ) . toEqual ( [ 1 , 2 ] ) ;
1679
+ expect ( gd . data [ 1 ] . selectedpoints ) . toBe ( undefined ) ;
1680
+ expect ( gd . data [ 2 ] . selectedpoints ) . toEqual ( [ 1 ] ) ;
1681
+ expect ( gd . data [ 3 ] . selectedpoints ) . toBe ( undefined ) ;
1682
+ } ) . then ( function ( ) {
1683
+ return drag ( [ [ 600 , 175 ] , [ 780 , 175 ] ] ) ; // Extend existing selection
1684
+ } ) . then ( function ( ) {
1685
+ expect ( gd . data [ 0 ] . selectedpoints ) . toEqual ( [ 1 , 2 ] ) ;
1686
+ expect ( gd . data [ 1 ] . selectedpoints ) . toBe ( undefined ) ;
1687
+ expect ( gd . data [ 2 ] . selectedpoints ) . toEqual ( [ 1 , 2 ] ) ;
1688
+ expect ( gd . data [ 3 ] . selectedpoints ) . toBe ( undefined ) ;
1689
+ } ) . then ( function ( ) {
1690
+ return drag ( [ [ 150 , 600 ] , [ 780 , 300 ] ] ) ;
1691
+ } ) . then ( function ( ) {
1692
+ expect ( gd . data [ 0 ] . selectedpoints ) . toEqual ( [ 1 , 2 ] ) ;
1693
+ expect ( gd . data [ 1 ] . selectedpoints ) . toEqual ( [ 1 , 2 ] ) ;
1694
+ expect ( gd . data [ 2 ] . selectedpoints ) . toEqual ( [ 1 , 2 ] ) ;
1695
+ expect ( gd . data [ 3 ] . selectedpoints ) . toEqual ( [ 1 , 2 ] ) ;
1696
+ } ) . then ( done , done . fail ) ;
1697
1697
} ) ;
1698
1698
} ) ;
1699
1699
0 commit comments