Skip to content

Commit

Permalink
fix(api): fix resizing event element
Browse files Browse the repository at this point in the history
Update resizing state value when .resize() is called to
prevent when resize.auto=false is set.

Fix #1695
  • Loading branch information
netil committed Oct 12, 2020
1 parent 815922e commit 6c12241
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Chart/api/chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ export default {
config.size_width = size ? size.width : null;
config.size_height = size ? size.height : null;

state.resizing = true;

this.flush(false, true);
$$.resizeFunction();
}
Expand Down
16 changes: 16 additions & 0 deletions test/api/chart-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,22 @@ describe("API chart", () => {
expect(chart.internal.getCurrentWidth()).to.be.equal(newSize.width);
expect(chart.internal.getCurrentHeight()).to.be.equal(newSize.height);
});

it("set options resize.auto=false", () => {
args.resize = {
auto: false
}
});

it("event <rect> element should resize", () => {
const {eventRect} = chart.internal.$el;
const height = +eventRect.attr("height");

// when
chart.resize({height:600});

expect(+eventRect.attr("height")).to.be.above(height);
});
});

describe("destroy()", () => {
Expand Down

0 comments on commit 6c12241

Please sign in to comment.