From d5eaa12d96bc059eae7d7768f5b4f4ee45fa42ca Mon Sep 17 00:00:00 2001 From: Jukka Kurkela Date: Fri, 4 Sep 2020 23:47:36 +0300 Subject: [PATCH] Fix: update chart when attached (#7758) --- src/core/core.controller.js | 2 +- test/specs/core.controller.tests.js | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/core.controller.js b/src/core/core.controller.js index 58b810b3f..2a932062c 100644 --- a/src/core/core.controller.js +++ b/src/core/core.controller.js @@ -1010,8 +1010,8 @@ class Chart { const attached = () => { _remove('attach', attached); - me.resize(); me.attached = true; + me.resize(); _add('resize', listener); _add('detach', detached); diff --git a/test/specs/core.controller.tests.js b/test/specs/core.controller.tests.js index e733d6a6b..12045a787 100644 --- a/test/specs/core.controller.tests.js +++ b/test/specs/core.controller.tests.js @@ -637,6 +637,7 @@ describe('Chart', function() { dw: 0, dh: 0, rw: 0, rh: 0, }); + expect(chart.chartArea).toBeUndefined(); waitForResize(chart, function() { expect(chart).toBeChartOfSize({ @@ -644,6 +645,8 @@ describe('Chart', function() { rw: 455, rh: 355, }); + expect(chart.chartArea).not.toBeUndefined(); + body.removeChild(wrapper); chart.destroy(); done(); -- 2.47.3