@@ -17,6 +17,7 @@ var assertHoverLabelStyle = customAssertions.assertHoverLabelStyle;
1717var assertHoverLabelContent = customAssertions . assertHoverLabelContent ;
1818var checkTextTemplate = require ( '../assets/check_texttemplate' ) ;
1919
20+ var SLICES_SELECTOR = '.treemaplayer path.surface' ;
2021var SLICES_TEXT_SELECTOR = '.treemaplayer text.slicetext' ;
2122
2223function _mouseEvent ( type , gd , v ) {
@@ -1889,3 +1890,51 @@ describe('treemap uniformtext', function() {
18891890 . then ( done ) ;
18901891 } ) ;
18911892} ) ;
1893+
1894+ describe ( 'treemap pathbar react' , function ( ) {
1895+ 'use strict' ;
1896+
1897+ var gd ;
1898+
1899+ beforeEach ( function ( ) {
1900+ gd = createGraphDiv ( ) ;
1901+ } ) ;
1902+
1903+ afterEach ( destroyGraphDiv ) ;
1904+
1905+ it ( 'should show and hide pathbar' , function ( done ) {
1906+ var fig = {
1907+ data : [ {
1908+ type : 'treemap' ,
1909+ parents : [ '' , 'A' , 'B' , 'C' ] ,
1910+ labels : [ 'A' , 'B' , 'C' , 'D' ] ,
1911+ level : 'C'
1912+ } ] ,
1913+ layout : { }
1914+ } ;
1915+
1916+ function _assert ( msg , exp ) {
1917+ return function ( ) {
1918+ var selection = d3 . selectAll ( SLICES_SELECTOR ) ;
1919+ var size = selection . size ( ) ;
1920+
1921+ expect ( size ) . toBe ( exp , msg ) ;
1922+ } ;
1923+ }
1924+
1925+ Plotly . plot ( gd , fig )
1926+ . then ( _assert ( 'default pathbar.visible: true' , 4 ) )
1927+ . then ( function ( ) {
1928+ fig . data [ 0 ] . pathbar = { visible : false } ;
1929+ return Plotly . react ( gd , fig ) ;
1930+ } )
1931+ . then ( _assert ( 'disable pathbar' , 2 ) )
1932+ . then ( function ( ) {
1933+ fig . data [ 0 ] . pathbar = { visible : true } ;
1934+ return Plotly . react ( gd , fig ) ;
1935+ } )
1936+ . then ( _assert ( 'enable pathbar' , 4 ) )
1937+ . catch ( failTest )
1938+ . then ( done ) ;
1939+ } ) ;
1940+ } ) ;
0 commit comments