diff --git a/packages/vx-legend/src/legends/Legend/LegendLabel.tsx b/packages/vx-legend/src/legends/Legend/LegendLabel.tsx index 1f1b89835..5b78652e5 100644 --- a/packages/vx-legend/src/legends/Legend/LegendLabel.tsx +++ b/packages/vx-legend/src/legends/Legend/LegendLabel.tsx @@ -1,6 +1,6 @@ import React from 'react'; -export type LegendLabelProps = { +export type LegendLabelOwnProps = { align?: string; label?: React.ReactNode; flex?: string | number; @@ -8,6 +8,9 @@ export type LegendLabelProps = { children?: React.ReactNode; }; +export type LegendLabelProps = LegendLabelOwnProps & + Omit, keyof LegendLabelOwnProps>; + export default function LegendLabel({ flex = '1', label, @@ -15,7 +18,7 @@ export default function LegendLabel({ align = 'left', children, ...restProps -}: LegendLabelProps & Omit, keyof LegendLabelProps>) { +}: LegendLabelProps) { return (
({ @@ -39,4 +39,11 @@ describe('', () => { flexDirection: 'row', }); }); + + test('it should pass through legendLabelProps to legend labels', () => { + const style = { fontFamily: 'Comic Sans' }; + const wrapper = shallow(); + const label = wrapper.find(LegendLabel).first(); + expect(label.prop('style')).toEqual(style); + }); });