@@ -1142,6 +1142,46 @@ describe('Test plot api', function() {
1142
1142
. catch ( fail )
1143
1143
. then ( done ) ;
1144
1144
} ) ;
1145
+
1146
+ it ( 'updates colorbars when editing bar charts' , function ( done ) {
1147
+ var mock = require ( '@mocks/bar-colorbar-colorscale.json' ) ;
1148
+
1149
+ Plotly . newPlot ( gd , mock . data , mock . layout )
1150
+ . then ( function ( ) {
1151
+ expect ( d3 . select ( '.cbaxis text' ) . style ( 'fill' ) ) . not . toBe ( 'rgb(255, 0, 0)' ) ;
1152
+
1153
+ return Plotly . restyle ( gd , { 'marker.colorbar.tickfont.color' : 'rgb(255, 0, 0)' } ) ;
1154
+ } )
1155
+ . then ( function ( ) {
1156
+ expect ( d3 . select ( '.cbaxis text' ) . style ( 'fill' ) ) . toBe ( 'rgb(255, 0, 0)' ) ;
1157
+
1158
+ return Plotly . restyle ( gd , { 'marker.showscale' : false } ) ;
1159
+ } )
1160
+ . then ( function ( ) {
1161
+ expect ( d3 . select ( '.cbaxis' ) . size ( ) ) . toBe ( 0 ) ;
1162
+ } )
1163
+ . catch ( fail )
1164
+ . then ( done ) ;
1165
+ } ) ;
1166
+
1167
+ it ( 'updates colorbars when editing gl3d plots' , function ( done ) {
1168
+ Plotly . newPlot ( gd , [ { z : [ [ 1 , 2 ] , [ 3 , 6 ] ] , type : 'surface' } ] )
1169
+ . then ( function ( ) {
1170
+ expect ( d3 . select ( '.cbaxis text' ) . style ( 'fill' ) ) . not . toBe ( 'rgb(255, 0, 0)' ) ;
1171
+
1172
+ return Plotly . restyle ( gd , { 'colorbar.tickfont.color' : 'rgb(255, 0, 0)' } ) ;
1173
+ } )
1174
+ . then ( function ( ) {
1175
+ expect ( d3 . select ( '.cbaxis text' ) . style ( 'fill' ) ) . toBe ( 'rgb(255, 0, 0)' ) ;
1176
+
1177
+ return Plotly . restyle ( gd , { 'showscale' : false } ) ;
1178
+ } )
1179
+ . then ( function ( ) {
1180
+ expect ( d3 . select ( '.cbaxis' ) . size ( ) ) . toBe ( 0 ) ;
1181
+ } )
1182
+ . catch ( fail )
1183
+ . then ( done ) ;
1184
+ } ) ;
1145
1185
} ) ;
1146
1186
1147
1187
describe ( 'Plotly.deleteTraces' , function ( ) {
0 commit comments