Skip to content

Commit

Permalink
fix(chart): Correct data label text prop ref
Browse files Browse the repository at this point in the history
Fix on incorrect referencing on data label's text elements

Fix #780
Close #781
  • Loading branch information
netil authored Feb 19, 2019
1 parent 91c8df2 commit d9f4477
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
11 changes: 9 additions & 2 deletions spec/internals/bb-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,17 @@ describe("Interface & initialization", () => {

it("Check for initialization", () => {
chart = util.generate({
title: {
text: "test"
},
data: {
columns: [
["data1", 30]
]
],
labels: {
show: true
},
type: "bar"
}
});
const internal = chart.internal;
Expand All @@ -41,7 +48,7 @@ describe("Interface & initialization", () => {
});

it("should be accessing node elements", () => {
const isD3Node = v => v && "node" in v || typeof v === "undefined";
const isD3Node = v => v && "node" in v || false;

Object.values(chart.$).forEach(v1 => {
const isNode = isD3Node(v1);
Expand Down
7 changes: 7 additions & 0 deletions spec/internals/data-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,13 @@ describe("DATA", () => {
});
});
});

it("text property shouldn't be empty", () => {
const texts = chart.$.text.texts;

expect(texts.empty()).to.be.false;
expect(texts.size() > 0).to.be.true;
});
});

describe("on area chart", () => {
Expand Down
2 changes: 1 addition & 1 deletion src/internals/ChartInternal.js
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ export default class ChartInternal {
circles: $$.mainCircle
},
text: {
texts: $$.texts
texts: $$.mainText
}
};
}
Expand Down

0 comments on commit d9f4477

Please sign in to comment.