File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -795,7 +795,10 @@ export const ChartMixin = (superClass) =>
795795 // Detect if the chart had already been initialized. This might happen in
796796 // environments where the chart is lazily attached (e.g Grid).
797797 if ( this . configuration ) {
798- this . __reflow ( ) ;
798+ const { height } = this . $ . wrapper . style ;
799+ this . $ . wrapper . style . height = '' ;
800+ this . configuration . setSize ( null , null , false ) ;
801+ this . $ . wrapper . style . height = height ;
799802 return ;
800803 }
801804
Original file line number Diff line number Diff line change @@ -260,6 +260,24 @@ describe('reattach', () => {
260260 expect ( chart . configuration . inverted ) . to . be . undefined ;
261261 } ) ;
262262
263+ it ( 'should restore default height when moving from different container with defined height' , async ( ) => {
264+ await oneEvent ( chart , 'chart-load' ) ;
265+
266+ const initialHeight = getComputedStyle ( chart ) . height ;
267+
268+ inner . style . height = '700px' ;
269+ inner . appendChild ( chart ) ;
270+ await nextFrame ( ) ;
271+
272+ expect ( getComputedStyle ( chart ) . height ) . to . be . equal ( inner . style . height ) ;
273+
274+ // Move back to first parent
275+ wrapper . appendChild ( chart ) ;
276+ await nextFrame ( ) ;
277+
278+ expect ( getComputedStyle ( chart ) . height ) . to . be . equal ( initialHeight ) ;
279+ } ) ;
280+
263281 describe ( 'series' , ( ) => {
264282 let series ;
265283
You can’t perform that action at this time.
0 commit comments