Skip to content

Commit

Permalink
fix(api): fix classname setting for eventRect element
Browse files Browse the repository at this point in the history
Fix the side effect caused by #3203.
Make sure to set proper class name for eventRect element.

Ref #3218
  • Loading branch information
netil committed May 18, 2023
1 parent 368b2df commit 0a2fbde
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/ChartInternal/interactions/eventrect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,8 @@ export default {
.attr("height", height);

// only for init
if (!rendered) {
rectElement.attr("class", $EVENT.eventRect);
if (!rendered || force) {
rectElement.classed($EVENT.eventRect, true);
}
}

Expand Down
9 changes: 8 additions & 1 deletion test/api/load-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import {expect} from "chai";
import {select as d3Select} from "d3-selection";
import {format as d3Format} from "d3-format";
import {$AREA, $AXIS, $COMMON, $CIRCLE, $LEGEND, $LINE} from "../../src/config/classes";
import {$AREA, $AXIS, $COMMON, $CIRCLE, $EVENT, $LEGEND, $LINE} from "../../src/config/classes";
import util from "../assets/util";

describe("API load", function() {
Expand Down Expand Up @@ -519,6 +519,9 @@ describe("API load", function() {
data: {
columns: [],
type: "area"
},
background: {
color: "red"
}
};
});
Expand All @@ -534,6 +537,8 @@ describe("API load", function() {
["dataX", 1, 2, 3, 4, 5, 6],
],
done: function() {
expect(this.internal.$el.eventRect.classed($EVENT.eventRect)).to.be.true;

this.tooltip.show({
data: {
x: 3,
Expand All @@ -552,6 +557,8 @@ describe("API load", function() {
});
}, 1000);
});


});

describe("different type loading", () => {
Expand Down

0 comments on commit 0a2fbde

Please sign in to comment.