From f6ee802cf2aaecb938ce11b7e90afd0103d1d0ec Mon Sep 17 00:00:00 2001 From: George Date: Wed, 4 Dec 2024 10:43:01 -0300 Subject: [PATCH] Add tests --- packages/polaris-viz/CHANGELOG.md | 4 ++++ .../src/components/LinePreview/tests/LinePreview.test.tsx | 8 ++++++++ .../src/components/shared/SeriesIcon/SeriesIcon.test.tsx | 8 ++++++++ 3 files changed, 20 insertions(+) diff --git a/packages/polaris-viz/CHANGELOG.md b/packages/polaris-viz/CHANGELOG.md index 7b09dbfd8..9e5a88397 100644 --- a/packages/polaris-viz/CHANGELOG.md +++ b/packages/polaris-viz/CHANGELOG.md @@ -9,6 +9,10 @@ and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## [15.3.4] - 2024-12-03 +### Added + +- Added dashed `lineStyle` support for custom legends in `` + ### Fixed - Fixed issue where `` would run the `seriesNameFormatter` for multiple times on a ``. diff --git a/packages/polaris-viz/src/components/LinePreview/tests/LinePreview.test.tsx b/packages/polaris-viz/src/components/LinePreview/tests/LinePreview.test.tsx index b16da34a7..c286e80b3 100644 --- a/packages/polaris-viz/src/components/LinePreview/tests/LinePreview.test.tsx +++ b/packages/polaris-viz/src/components/LinePreview/tests/LinePreview.test.tsx @@ -20,4 +20,12 @@ describe('', () => { expect(linePreview).toContainReactComponentTimes('circle', 3); }); + + it('renders a dashed path if lineStyle is dashed', () => { + const linePreview = mount(); + + expect(linePreview).toContainReactComponent('path', { + strokeDasharray: '1.5 3', + }); + }); }); diff --git a/packages/polaris-viz/src/components/shared/SeriesIcon/SeriesIcon.test.tsx b/packages/polaris-viz/src/components/shared/SeriesIcon/SeriesIcon.test.tsx index f71b0788e..d0aa15884 100644 --- a/packages/polaris-viz/src/components/shared/SeriesIcon/SeriesIcon.test.tsx +++ b/packages/polaris-viz/src/components/shared/SeriesIcon/SeriesIcon.test.tsx @@ -52,4 +52,12 @@ describe('isComparison', () => { lineStyle: 'dotted', }); }); + + it('renders LinePreview as dashed when lineStyle prop is set to dashed', () => { + const component = mount( + , + ); + + expect(component.find(LinePreview)).toHaveReactProps({lineStyle: 'dashed'}); + }); });