From: Jukka Kurkela Date: Fri, 4 Sep 2020 20:47:36 +0000 (+0300) Subject: Fix: update chart when attached (#7758) X-Git-Tag: v3.0.0-beta.2~1^2~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d5eaa12d96bc059eae7d7768f5b4f4ee45fa42ca;p=thirdparty%2FChart.js.git Fix: update chart when attached (#7758) --- 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();