Skip to content

Commit

Permalink
fix: 修复双轴图单测 (#2505)
Browse files Browse the repository at this point in the history
  • Loading branch information
visiky authored Apr 13, 2021
1 parent 9bedcec commit 1623ca8
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions __tests__/unit/plots/dual-axes/color-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ describe('color', () => {
// legend 颜色
const legendComponentItem = dualAxes.chart.getController('legend').getComponents()[0].component.cfg.items;
legendComponentItem.forEach((legendItem, index) => {
const color = legendItem.marker.style.fill || legendItem.marker.style.stroke;
// lineWidth > 0, 则颜色为 stroke
const markerStyle = legendItem.marker.style;
const color = markerStyle.lineWidth > 0 ? markerStyle.stroke : markerStyle.fill;
expect(color).toBe(['#f00', '#0f0', '#00f'][index]);
});

Expand Down Expand Up @@ -82,7 +84,8 @@ describe('color', () => {

const legendComponentItem = dualAxes.chart.getController('legend').getComponents()[0].component.cfg.items;
legendComponentItem.forEach((legendItem, index) => {
const color = legendItem.marker.style.fill || legendItem.marker.style.stroke;
const markerStyle = legendItem.marker.style;
const color = markerStyle.lineWidth > 0 ? markerStyle.stroke : markerStyle.fill;
expect(color).toBe(colors10[index]);
});
dualAxes.destroy();
Expand Down Expand Up @@ -176,7 +179,8 @@ describe('color', () => {

const legendComponentItem = dualAxes.chart.getController('legend').getComponents()[0].component.cfg.items;
legendComponentItem.forEach((legendItem, index) => {
const color = legendItem.marker.style.fill || legendItem.marker.style.stroke;
const markerStyle = legendItem.marker.style;
const color = markerStyle.lineWidth > 0 ? markerStyle.stroke : markerStyle.fill;
expect(color).toBe(colors10.concat(colors10)[index]);
});
dualAxes.destroy();
Expand Down

0 comments on commit 1623ca8

Please sign in to comment.