@@ -1162,7 +1162,7 @@ describe('Test sunburst restyle:', function () {
11621162 }
11631163
11641164 Plotly . newPlot ( gd , mock )
1165- . then ( _assert ( 'base' , [ 'Root\nnode0 ' , 'B\nnode2 ' , 'A\nnode1 ' , 'b\nnode3 ' ] ) )
1165+ . then ( _assert ( 'base' , [ 'node0\nRoot ' , 'node2\nB ' , 'node1\nA ' , 'node3\nb ' ] ) )
11661166 . then ( function ( ) {
11671167 spyOn ( Plots , 'doCalcdata' ) . and . callThrough ( ) ;
11681168 } )
@@ -1173,32 +1173,54 @@ describe('Test sunburst restyle:', function () {
11731173 . then ( _restyle ( { textinfo : 'none' } ) )
11741174 . then ( _assert ( 'no textinfo' , [ '' , '' , '' , '' ] ) )
11751175 . then ( _restyle ( { textinfo : 'label+text+value' } ) )
1176- . then ( _assert ( 'show everything' , [ 'Root\n0\ nnode0' , 'B\n2\ nnode2' , 'A\n1\ nnode1' , 'b\n3\ nnode3' ] ) )
1176+ . then ( _assert ( 'show everything' , [ 'Root\nnode0\n0 ' , 'B\nnode2\n2 ' , 'A\nnode1\n1 ' , 'b\nnode3\n3 ' ] ) )
11771177 . then ( _restyle ( { textinfo : null } ) )
1178- . then ( _assert ( 'back to dflt' , [ 'Root\nnode0 ' , 'B\nnode2 ' , 'A\nnode1 ' , 'b\nnode3 ' ] ) )
1178+ . then ( _assert ( 'back to dflt' , [ 'node0\nRoot ' , 'node2\nB ' , 'node1\nA ' , 'node3\nb ' ] ) )
11791179 // now change insidetextorientation to 'horizontal'
11801180 . then ( _restyle ( { insidetextorientation : 'horizontal' } ) )
1181- . then ( _assert ( 'back to dflt' , [ 'Root\nnode0 ' , 'B\nnode2 ' , 'A\nnode1 ' , 'b\nnode3 ' ] ) )
1181+ . then ( _assert ( 'back to dflt' , [ 'node0\nRoot ' , 'node2\nB ' , 'node1\nA ' , 'node3\nb ' ] ) )
11821182 . then ( _restyle ( { textinfo : 'none' } ) )
11831183 . then ( _assert ( 'no textinfo' , [ '' , '' , '' , '' ] ) )
11841184 . then ( _restyle ( { textinfo : null } ) )
1185- . then ( _assert ( 'back to dflt' , [ 'Root\nnode0 ' , 'B\nnode2 ' , 'A\nnode1 ' , 'b\nnode3 ' ] ) )
1185+ . then ( _assert ( 'back to dflt' , [ 'node0\nRoot ' , 'node2\nB ' , 'node1\nA ' , 'node3\nb ' ] ) )
11861186 // now change insidetextorientation to 'tangential'
11871187 . then ( _restyle ( { insidetextorientation : 'tangential' } ) )
1188- . then ( _assert ( 'back to dflt' , [ 'Root\nnode0 ' , 'B\nnode2 ' , 'A\nnode1 ' , 'b\nnode3 ' ] ) )
1188+ . then ( _assert ( 'back to dflt' , [ 'node0\nRoot ' , 'node2\nB ' , 'node1\nA ' , 'node3\nb ' ] ) )
11891189 . then ( _restyle ( { textinfo : 'none' } ) )
11901190 . then ( _assert ( 'no textinfo' , [ '' , '' , '' , '' ] ) )
11911191 . then ( _restyle ( { textinfo : null } ) )
1192- . then ( _assert ( 'back to dflt' , [ 'Root\nnode0 ' , 'B\nnode2 ' , 'A\nnode1 ' , 'b\nnode3 ' ] ) )
1192+ . then ( _assert ( 'back to dflt' , [ 'node0\nRoot ' , 'node2\nB ' , 'node1\nA ' , 'node3\nb ' ] ) )
11931193 // now change insidetextorientation to 'radial'
11941194 . then ( _restyle ( { insidetextorientation : 'radial' } ) )
1195- . then ( _assert ( 'back to dflt' , [ 'Root\nnode0 ' , 'B\nnode2 ' , 'A\nnode1 ' , 'b\nnode3 ' ] ) )
1195+ . then ( _assert ( 'back to dflt' , [ 'node0\nRoot ' , 'node2\nB ' , 'node1\nA ' , 'node3\nb ' ] ) )
11961196 . then ( _restyle ( { textinfo : 'none' } ) )
11971197 . then ( _assert ( 'no textinfo' , [ '' , '' , '' , '' ] ) )
11981198 . then ( _restyle ( { textinfo : null } ) )
1199- . then ( _assert ( 'back to dflt' , [ 'Root\nnode0 ' , 'B\nnode2 ' , 'A\nnode1 ' , 'b\nnode3 ' ] ) )
1199+ . then ( _assert ( 'back to dflt' , [ 'node0\nRoot ' , 'node2\nB ' , 'node1\nA ' , 'node3\nb ' ] ) )
12001200 . then ( done , done . fail ) ;
12011201 } ) ;
1202+
1203+ it ( 'should respect textinfo token order' , function ( done ) {
1204+ Plotly . newPlot ( gd , [ {
1205+ type : 'sunburst' ,
1206+ labels : [ 'Root' , 'A' , 'B' ] ,
1207+ parents : [ '' , 'Root' , 'Root' ] ,
1208+ values : [ 0 , 10 , 20 ] ,
1209+ textinfo : 'percent root+value+label'
1210+ } ] , { } )
1211+ . then ( function ( ) {
1212+ var layer = d3Select ( gd ) . select ( '.sunburstlayer' ) ;
1213+ var textContent = [ ] ;
1214+ layer . selectAll ( 'text.slicetext' ) . each ( function ( ) {
1215+ textContent . push ( this . textContent ) ;
1216+ } ) ;
1217+ expect ( textContent . length ) . toBe ( 3 ) ;
1218+ expect ( textContent [ 0 ] ) . toBe ( '0Root' ) ;
1219+ expect ( textContent [ 1 ] ) . toBe ( '67%20B' ) ;
1220+ expect ( textContent [ 2 ] ) . toBe ( '33%10A' ) ;
1221+ } )
1222+ . then ( done , done . fail ) ;
1223+ } ) ;
12021224} ) ;
12031225
12041226describe ( 'Test sunburst tweening:' , function ( ) {
0 commit comments