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();