From 1623ca80014c87ff08e6d5b305ec0fd1bf084eaf Mon Sep 17 00:00:00 2001 From: Visiky <736929286@qq.com> Date: Tue, 13 Apr 2021 10:51:56 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=8F=8C=E8=BD=B4?= =?UTF-8?q?=E5=9B=BE=E5=8D=95=E6=B5=8B=20(#2505)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- __tests__/unit/plots/dual-axes/color-spec.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/__tests__/unit/plots/dual-axes/color-spec.ts b/__tests__/unit/plots/dual-axes/color-spec.ts index ff6cf1df1c..1defd49167 100644 --- a/__tests__/unit/plots/dual-axes/color-spec.ts +++ b/__tests__/unit/plots/dual-axes/color-spec.ts @@ -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]); }); @@ -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(); @@ -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();