Skip to content

Commit

Permalink
Fix: update chart when attached (#7758)
Browse files Browse the repository at this point in the history
  • Loading branch information
kurkle authored Sep 4, 2020
1 parent c749fbd commit d5eaa12
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/core.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -1010,8 +1010,8 @@ class Chart {
const attached = () => {
_remove('attach', attached);

me.resize();
me.attached = true;
me.resize();

_add('resize', listener);
_add('detach', detached);
Expand Down
3 changes: 3 additions & 0 deletions test/specs/core.controller.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -637,13 +637,16 @@ describe('Chart', function() {
dw: 0, dh: 0,
rw: 0, rh: 0,
});
expect(chart.chartArea).toBeUndefined();

waitForResize(chart, function() {
expect(chart).toBeChartOfSize({
dw: 455, dh: 355,
rw: 455, rh: 355,
});

expect(chart.chartArea).not.toBeUndefined();

body.removeChild(wrapper);
chart.destroy();
done();
Expand Down

0 comments on commit d5eaa12

Please sign in to comment.