@@ -1519,6 +1519,53 @@ describe('legend interaction', function() {
1519
1519
} ) ;
1520
1520
} ) ;
1521
1521
1522
+ describe ( 'legend visibility with *showlegend:false* traces' , function ( ) {
1523
+ beforeEach ( function ( done ) {
1524
+ Plotly . plot ( gd , [
1525
+ { y : [ 1 , 2 , 3 ] } ,
1526
+ { y : [ 2 , 3 , 1 ] } ,
1527
+ { type : 'heatmap' , z : [ [ 1 , 2 ] , [ 3 , 4 ] ] , showscale : false }
1528
+ ] )
1529
+ . then ( done ) ;
1530
+ } ) ;
1531
+
1532
+ it ( 'isolate trace in legend, ignore trace that is not in legend' , function ( done ) {
1533
+ Promise . resolve ( )
1534
+ . then ( click ( 0 , 2 ) )
1535
+ . then ( assertVisible ( [ true , 'legendonly' , true ] ) )
1536
+ . then ( click ( 0 , 2 ) )
1537
+ . then ( assertVisible ( [ true , true , true ] ) )
1538
+ . catch ( failTest ) . then ( done ) ;
1539
+ } ) ;
1540
+
1541
+ it ( 'isolate trace in legend, ignore trace that is not in legend (2)' , function ( done ) {
1542
+ Promise . resolve ( )
1543
+ . then ( click ( 1 , 2 ) )
1544
+ . then ( assertVisible ( [ 'legendonly' , true , true ] ) )
1545
+ . then ( click ( 1 , 2 ) )
1546
+ . then ( assertVisible ( [ true , true , true ] ) )
1547
+ . catch ( failTest ) . then ( done ) ;
1548
+ } ) ;
1549
+
1550
+ it ( 'isolate trace in legend AND trace in associated legendgroup' , function ( done ) {
1551
+ Plotly . restyle ( gd , 'legendgroup' , [ 'group' , '' , 'group' ] )
1552
+ . then ( click ( 0 , 2 ) )
1553
+ . then ( assertVisible ( [ true , 'legendonly' , true ] ) )
1554
+ . then ( click ( 0 , 2 ) )
1555
+ . then ( assertVisible ( [ true , true , true ] ) )
1556
+ . catch ( failTest ) . then ( done ) ;
1557
+ } ) ;
1558
+
1559
+ it ( 'isolate trace in legend, hide trace not in legend that has set legendgroup' , function ( done ) {
1560
+ Plotly . restyle ( gd , 'legendgroup' , [ 'group' , '' , 'group' ] )
1561
+ . then ( click ( 1 , 2 ) )
1562
+ . then ( assertVisible ( [ 'legendonly' , true , 'legendonly' ] ) )
1563
+ . then ( click ( 1 , 2 ) )
1564
+ . then ( assertVisible ( [ true , true , true ] ) )
1565
+ . catch ( failTest ) . then ( done ) ;
1566
+ } ) ;
1567
+ } ) ;
1568
+
1522
1569
describe ( 'custom legend click/doubleclick handlers' , function ( ) {
1523
1570
var fig , to ;
1524
1571
0 commit comments