@@ -1184,6 +1184,39 @@ describe('stacked area', function() {
1184
1184
. then ( done ) ;
1185
1185
} ) ;
1186
1186
1187
+ it ( 'can add/delete stack groups' , function ( done ) {
1188
+ var data01 = [
1189
+ { mode : 'markers' , y : [ 1 , 2 , - 1 , 2 , 1 ] , stackgroup : 'a' } ,
1190
+ { mode : 'markers' , y : [ 2 , 3 , 2 , 3 , 2 ] , stackgroup : 'b' }
1191
+ ] ;
1192
+ var data0 = [ Lib . extendDeep ( { } , data01 [ 0 ] ) ] ;
1193
+ var data1 = [ Lib . extendDeep ( { } , data01 [ 1 ] ) ] ;
1194
+
1195
+ function _assert ( yRange , nTraces ) {
1196
+ expect ( gd . _fullLayout . yaxis . range ) . toBeCloseToArray ( yRange , 2 ) ;
1197
+ expect ( gd . querySelectorAll ( 'g.trace.scatter' ) . length ) . toBe ( nTraces ) ;
1198
+ }
1199
+
1200
+ Plotly . newPlot ( gd , data01 )
1201
+ . then ( function ( ) {
1202
+ _assert ( [ - 1.293 , 3.293 ] , 2 ) ;
1203
+ return Plotly . react ( gd , data0 ) ;
1204
+ } )
1205
+ . then ( function ( ) {
1206
+ _assert ( [ - 1.220 , 2.220 ] , 1 ) ;
1207
+ return Plotly . react ( gd , data01 ) ;
1208
+ } )
1209
+ . then ( function ( ) {
1210
+ _assert ( [ - 1.293 , 3.293 ] , 2 ) ;
1211
+ return Plotly . react ( gd , data1 ) ;
1212
+ } )
1213
+ . then ( function ( ) {
1214
+ _assert ( [ 0 , 3.205 ] , 1 ) ;
1215
+ } )
1216
+ . catch ( failTest )
1217
+ . then ( done ) ;
1218
+ } ) ;
1219
+
1187
1220
it ( 'does not stack on date axes' , function ( done ) {
1188
1221
Plotly . newPlot ( gd , [
1189
1222
{ y : [ '2016-01-01' , '2017-01-01' ] , stackgroup : 'a' } ,
0 commit comments