Commit 690a96e4 by Erik Sundell Committed by GitHub

make sure stats are added horizontally and not vertically (#30106)

parent 3db5abbe
...@@ -8,12 +8,14 @@ describe('Stats', () => { ...@@ -8,12 +8,14 @@ describe('Stats', () => {
it('should render component', () => { it('should render component', () => {
render( render(
<Stats <Stats
data-testid="stats"
values={['Average', 'Minimum']} values={['Average', 'Minimum']}
variableOptionGroup={{ label: 'templateVar', value: 'templateVar' }} variableOptionGroup={{ label: 'templateVar', value: 'templateVar' }}
onChange={() => {}} onChange={() => {}}
stats={['Average', 'Maximum', 'Minimum', 'Sum', 'SampleCount'].map(toOption)} stats={['Average', 'Maximum', 'Minimum', 'Sum', 'SampleCount'].map(toOption)}
/> />
); );
expect(screen.getByTestId('stats')).toBeInTheDocument(); expect(screen.getByText('Average')).toBeInTheDocument();
expect(screen.getByText('Minimum')).toBeInTheDocument();
}); });
}); });
...@@ -14,7 +14,7 @@ const removeText = '-- remove stat --'; ...@@ -14,7 +14,7 @@ const removeText = '-- remove stat --';
const removeOption: SelectableValue<string> = { label: removeText, value: removeText }; const removeOption: SelectableValue<string> = { label: removeText, value: removeText };
export const Stats: FunctionComponent<Props> = ({ stats, values, onChange, variableOptionGroup }) => ( export const Stats: FunctionComponent<Props> = ({ stats, values, onChange, variableOptionGroup }) => (
<div data-testid="stats"> <>
{values && {values &&
values.map((value, index) => ( values.map((value, index) => (
<Segment <Segment
...@@ -41,5 +41,5 @@ export const Stats: FunctionComponent<Props> = ({ stats, values, onChange, varia ...@@ -41,5 +41,5 @@ export const Stats: FunctionComponent<Props> = ({ stats, values, onChange, varia
onChange={({ value }) => onChange([...values, value!])} onChange={({ value }) => onChange([...values, value!])}
options={[...stats.filter(({ value }) => !values.includes(value!)), variableOptionGroup]} options={[...stats.filter(({ value }) => !values.includes(value!)), variableOptionGroup]}
/> />
</div> </>
); );
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment