@@ -691,6 +691,62 @@ describe('Pie traces', function() {
691691 . then ( done ) ;
692692 } ) ;
693693 } ) ;
694+
695+ it ( 'should be able to restyle title color' , function ( done ) {
696+ function _assert ( msg , exp ) {
697+ var title = d3 . select ( '.titletext > text' ) . node ( ) ;
698+ expect ( title . style . fill ) . toBe ( exp . color , msg ) ;
699+ }
700+
701+ Plotly . plot ( gd , [ {
702+ type : 'pie' ,
703+ values : [ 1 , 2 , 3 ] ,
704+ title : 'yo' ,
705+ titlefont : { color : 'blue' }
706+ } ] )
707+ . then ( function ( ) {
708+ _assert ( 'base' , { color : 'rgb(0, 0, 255)' } ) ;
709+ return Plotly . restyle ( gd , 'titlefont.color' , 'red' ) ;
710+ } )
711+ . then ( function ( ) {
712+ _assert ( 'base' , { color : 'rgb(255, 0, 0)' } ) ;
713+ } )
714+ . catch ( failTest )
715+ . then ( done ) ;
716+ } ) ;
717+
718+ it ( 'should be able to react with new text colors' , function ( done ) {
719+ Plotly . plot ( gd , [ {
720+ type : 'pie' ,
721+ values : [ 1 , 2 , 3 ] ,
722+ text : [ 'A' , 'B' , 'C' ] ,
723+ textposition : 'inside'
724+ } ] )
725+ . then ( _checkFontColors ( [ 'rgb(255, 255, 255)' , 'rgb(68, 68, 68)' , 'rgb(255, 255, 255)' ] ) )
726+ . then ( function ( ) {
727+ gd . data [ 0 ] . insidetextfont = { color : 'red' } ;
728+ return Plotly . react ( gd , gd . data ) ;
729+ } )
730+ . then ( _checkFontColors ( [ 'rgb(255, 0, 0)' , 'rgb(255, 0, 0)' , 'rgb(255, 0, 0)' ] ) )
731+ . then ( function ( ) {
732+ delete gd . data [ 0 ] . insidetextfont . color ;
733+ gd . data [ 0 ] . textfont = { color : 'blue' } ;
734+ return Plotly . react ( gd , gd . data ) ;
735+ } )
736+ . then ( _checkFontColors ( [ 'rgb(0, 0, 255)' , 'rgb(0, 0, 255)' , 'rgb(0, 0, 255)' ] ) )
737+ . then ( function ( ) {
738+ gd . data [ 0 ] . textposition = 'outside' ;
739+ return Plotly . react ( gd , gd . data ) ;
740+ } )
741+ . then ( _checkFontColors ( [ 'rgb(0, 0, 255)' , 'rgb(0, 0, 255)' , 'rgb(0, 0, 255)' ] ) )
742+ . then ( function ( ) {
743+ gd . data [ 0 ] . outsidetextfont = { color : 'red' } ;
744+ return Plotly . react ( gd , gd . data ) ;
745+ } )
746+ . then ( _checkFontColors ( [ 'rgb(255, 0, 0)' , 'rgb(255, 0, 0)' , 'rgb(255, 0, 0)' ] ) )
747+ . catch ( failTest )
748+ . then ( done ) ;
749+ } ) ;
694750} ) ;
695751
696752describe ( 'pie hovering' , function ( ) {
0 commit comments