From 7eff7838c915ca1843706830ae3983678dcfe908 Mon Sep 17 00:00:00 2001 From: Ashik Meerankutty Date: Sat, 5 Sep 2020 12:53:06 +0530 Subject: [PATCH 1/3] Make value field not required --- src/components/expression/expression.test.tsx | 12 ++++++++++++ src/components/expression/expression.tsx | 10 ++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/components/expression/expression.test.tsx b/src/components/expression/expression.test.tsx index 72778d81e96..1f0317f6741 100644 --- a/src/components/expression/expression.test.tsx +++ b/src/components/expression/expression.test.tsx @@ -38,6 +38,18 @@ describe('EuiExpression', () => { expect(render(component)).toMatchSnapshot(); }); + test('render with only description', () => { + const component = ( + {}} + {...requiredProps} + /> + ); + expect(render(component)).toMatchSnapshot(); + }); + describe('props', () => { describe('color', () => { COLORS.forEach(color => { diff --git a/src/components/expression/expression.tsx b/src/components/expression/expression.tsx index 6c732ee9459..3c3323863e6 100644 --- a/src/components/expression/expression.tsx +++ b/src/components/expression/expression.tsx @@ -60,7 +60,7 @@ export type EuiExpressionProps = CommonProps & { /** * Second part of the expression */ - value: ReactNode; + value?: ReactNode; valueProps?: HTMLAttributes; /** * Color of the `description` @@ -170,9 +170,11 @@ export const EuiExpression: FunctionComponent {description} {' '} - - {value} - + {value && ( + + {value} + + )} {invalidIcon} ); From 84eb8d58e39a880feed8cda6a348b3a768cc6305 Mon Sep 17 00:00:00 2001 From: Ashik Meerankutty Date: Sat, 5 Sep 2020 12:56:02 +0530 Subject: [PATCH 2/3] Updated snpashot --- .../__snapshots__/expression.test.tsx.snap | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/components/expression/__snapshots__/expression.test.tsx.snap b/src/components/expression/__snapshots__/expression.test.tsx.snap index 9d97367d008..191c32ab740 100644 --- a/src/components/expression/__snapshots__/expression.test.tsx.snap +++ b/src/components/expression/__snapshots__/expression.test.tsx.snap @@ -276,6 +276,21 @@ exports[`EuiExpression props uppercase true renders uppercase 1`] = ` `; +exports[`EuiExpression render with only description 1`] = ` + +`; + exports[`EuiExpression renders 1`] = `