@@ -1579,4 +1579,46 @@ describe('ModeBar', function() {
1579
1579
. then ( done ) ;
1580
1580
} ) ;
1581
1581
} ) ;
1582
+
1583
+ describe ( 'modebar html' , function ( ) {
1584
+ var gd ;
1585
+ var traces = [
1586
+ { type : 'scatter' , x : [ 1 , 2 ] , y : [ 1 , 2 ] } ,
1587
+ { type : 'scatter3d' , x : [ 1 , 2 ] , y : [ 1 , 2 ] , z : [ 1 , 2 ] } ,
1588
+ { type : 'surface' , z : [ [ 1 , 2 ] , [ 1 , 2 ] ] } ,
1589
+ { type : 'heatmap' , z : [ [ 1 , 2 ] , [ 1 , 2 ] ] } ,
1590
+ ] ;
1591
+
1592
+ beforeEach ( function ( ) {
1593
+ gd = createGraphDiv ( ) ;
1594
+ } ) ;
1595
+
1596
+ afterEach ( function ( ) {
1597
+ Plotly . purge ( gd ) ;
1598
+ destroyGraphDiv ( ) ;
1599
+ } ) ;
1600
+
1601
+ function getModebarDiv ( ) {
1602
+ return document . getElementById ( 'modebar-' + gd . _fullLayout . _uid ) ;
1603
+ }
1604
+
1605
+ traces . forEach ( function ( fromTrace ) {
1606
+ traces . forEach ( function ( toTrace ) {
1607
+ it ( 'is still present when switching from ' + fromTrace . type + ' to ' + toTrace . type , function ( done ) {
1608
+ Plotly . plot ( gd , [ fromTrace ] , { } )
1609
+ . then ( function ( ) {
1610
+ expect ( getModebarDiv ( ) ) . toBeTruthy ( ) ;
1611
+ expect ( getModebarDiv ( ) . innerHTML ) . toBeTruthy ( ) ;
1612
+ } )
1613
+ . then ( Plotly . react ( gd , [ toTrace ] ) )
1614
+ . then ( function ( ) {
1615
+ expect ( getModebarDiv ( ) ) . toBeTruthy ( ) ;
1616
+ expect ( getModebarDiv ( ) . innerHTML ) . toBeTruthy ( ) ;
1617
+ } )
1618
+ . then ( done )
1619
+ . catch ( failTest ) ;
1620
+ } ) ;
1621
+ } ) ;
1622
+ } ) ;
1623
+ } ) ;
1582
1624
} ) ;
0 commit comments