@@ -1672,56 +1672,58 @@ describe('legend interaction', function() {
1672
1672
1673
1673
function run ( ) {
1674
1674
return Promise . resolve ( )
1675
- . then ( click ( 0 , 1 ) ) . then ( _assert ( [ 'legendonly' , true ] ) )
1676
- . then ( click ( 0 , 1 ) ) . then ( _assert ( [ true , true ] ) )
1677
- . then ( click ( 0 , 2 ) ) . then ( _assert ( [ true , 'legendonly' ] ) )
1678
- . then ( click ( 0 , 2 ) ) . then ( _assert ( [ true , true ] ) )
1675
+ . then ( click ( 0 , 1 ) ) . then ( _assert ( [ 'legendonly' , true , true ] ) )
1676
+ . then ( click ( 0 , 1 ) ) . then ( _assert ( [ true , true , true ] ) )
1677
+ . then ( click ( 0 , 2 ) ) . then ( _assert ( [ true , 'legendonly' , 'legendonly' ] ) )
1678
+ . then ( click ( 0 , 2 ) ) . then ( _assert ( [ true , true , true ] ) )
1679
1679
. then ( function ( ) {
1680
1680
return Plotly . relayout ( gd , {
1681
1681
'legend.itemclick' : false ,
1682
1682
'legend.itemdoubleclick' : false
1683
1683
} ) ;
1684
1684
} )
1685
- . then ( click ( 0 , 1 ) ) . then ( _assert ( [ true , true ] ) )
1686
- . then ( click ( 0 , 2 ) ) . then ( _assert ( [ true , true ] ) )
1685
+ . then ( click ( 0 , 1 ) ) . then ( _assert ( [ true , true , true ] ) )
1686
+ . then ( click ( 0 , 2 ) ) . then ( _assert ( [ true , true , true ] ) )
1687
1687
. then ( function ( ) {
1688
1688
return Plotly . relayout ( gd , {
1689
1689
'legend.itemclick' : 'focus' ,
1690
1690
'legend.itemdoubleclick' : 'toggle'
1691
1691
} ) ;
1692
1692
} )
1693
- . then ( click ( 0 , 1 ) ) . then ( _assert ( [ true , 'legendonly' ] ) )
1694
- . then ( click ( 0 , 1 ) ) . then ( _assert ( [ true , true ] ) )
1695
- . then ( click ( 0 , 2 ) ) . then ( _assert ( [ 'legendonly' , true ] ) )
1696
- . then ( click ( 0 , 2 ) ) . then ( _assert ( [ true , true ] ) ) ;
1693
+ . then ( click ( 0 , 1 ) ) . then ( _assert ( [ true , 'legendonly' , 'legendonly' ] ) )
1694
+ . then ( click ( 0 , 1 ) ) . then ( _assert ( [ true , true , true ] ) )
1695
+ . then ( click ( 0 , 2 ) ) . then ( _assert ( [ 'legendonly' , true , true ] ) )
1696
+ . then ( click ( 0 , 2 ) ) . then ( _assert ( [ true , true , true ] ) ) ;
1697
1697
}
1698
1698
1699
1699
it ( '- regular trace case' , function ( done ) {
1700
1700
_assert = assertVisible ;
1701
1701
1702
1702
Plotly . plot ( gd , [
1703
1703
{ y : [ 1 , 2 , 1 ] } ,
1704
- { y : [ 2 , 1 , 2 ] }
1704
+ { y : [ 2 , 1 , 2 ] } ,
1705
+ { y : [ 3 , 5 , 0 ] }
1705
1706
] )
1706
1707
. then ( run )
1707
1708
. catch ( failTest )
1708
1709
. then ( done ) ;
1709
1710
} ) ;
1710
1711
1711
1712
it ( '- pie case' , function ( done ) {
1712
- _assert = function ( exp ) {
1713
+ _assert = function ( _exp ) {
1713
1714
return function ( ) {
1714
- var actual = [ ] ;
1715
- if ( exp [ 0 ] === 'legendonly' ) actual . push ( 'B' ) ;
1716
- if ( exp [ 1 ] === 'legendonly' ) actual . push ( 'A' ) ;
1717
- expect ( actual ) . toEqual ( gd . _fullLayout . hiddenlabels || [ ] ) ;
1715
+ var exp = [ ] ;
1716
+ if ( _exp [ 0 ] === 'legendonly' ) exp . push ( 'C' ) ;
1717
+ if ( _exp [ 1 ] === 'legendonly' ) exp . push ( 'B' ) ;
1718
+ if ( _exp [ 2 ] === 'legendonly' ) exp . push ( 'A' ) ;
1719
+ expect ( gd . _fullLayout . hiddenlabels || [ ] ) . toEqual ( exp ) ;
1718
1720
} ;
1719
1721
} ;
1720
1722
1721
1723
Plotly . plot ( gd , [ {
1722
1724
type : 'pie' ,
1723
- labels : [ 'A' , 'B' ] ,
1724
- values : [ 1 , 2 ]
1725
+ labels : [ 'A' , 'B' , 'C' ] ,
1726
+ values : [ 1 , 2 , 3 ]
1725
1727
} ] )
1726
1728
. then ( run )
1727
1729
. catch ( failTest )
0 commit comments