@@ -1782,6 +1782,49 @@ describe('legend interaction', function() {
1782
1782
} ) ;
1783
1783
} ) ;
1784
1784
1785
+ describe ( 'legendgroup visibility case of groupclick: "toggleitem"' , function ( ) {
1786
+ beforeEach ( function ( done ) {
1787
+ Plotly . newPlot ( gd , [ {
1788
+ x : [ 1 , 2 ] ,
1789
+ y : [ 3 , 4 ] ,
1790
+ visible : false
1791
+ } , {
1792
+ x : [ 1 , 2 , 3 , 4 ] ,
1793
+ y : [ 0 , 1 , 2 , 3 ] ,
1794
+ legendgroup : 'foo'
1795
+ } , {
1796
+ x : [ 1 , 2 , 3 , 4 ] ,
1797
+ y : [ 1 , 3 , 2 , 4 ] ,
1798
+ } , {
1799
+ x : [ 1 , 2 , 3 , 4 ] ,
1800
+ y : [ 1 , 3 , 2 , 4 ] ,
1801
+ legendgroup : 'foo'
1802
+ } ] , {
1803
+ legend : {
1804
+ groupclick : 'toggleitem'
1805
+ }
1806
+ } ) . then ( done ) ;
1807
+ } ) ;
1808
+
1809
+ it ( 'toggles visibilities' , function ( done ) {
1810
+ Promise . resolve ( )
1811
+ . then ( assertVisible ( [ false , true , true , true ] ) )
1812
+ . then ( click ( 0 ) )
1813
+ . then ( assertVisible ( [ false , 'legendonly' , true , true ] ) )
1814
+ . then ( click ( 0 ) )
1815
+ . then ( assertVisible ( [ false , true , true , true ] ) )
1816
+ . then ( click ( 1 ) )
1817
+ . then ( assertVisible ( [ false , true , true , 'legendonly' ] ) )
1818
+ . then ( click ( 1 ) )
1819
+ . then ( assertVisible ( [ false , true , true , true ] ) )
1820
+ . then ( click ( 2 ) )
1821
+ . then ( assertVisible ( [ false , true , 'legendonly' , true ] ) )
1822
+ . then ( click ( 2 ) )
1823
+ . then ( assertVisible ( [ false , true , true , true ] ) )
1824
+ . then ( done , done . fail ) ;
1825
+ } ) ;
1826
+ } ) ;
1827
+
1785
1828
describe ( 'legend visibility toggles with groupby' , function ( ) {
1786
1829
beforeEach ( function ( done ) {
1787
1830
Plotly . newPlot ( gd , [ {
0 commit comments