diff --git a/frontend/src/component/common/StrategyItemContainer/StrategyItemContainer.test.tsx b/frontend/src/component/common/StrategyItemContainer/StrategyItemContainer.test.tsx new file mode 100644 index 0000000000..8ca44f4762 --- /dev/null +++ b/frontend/src/component/common/StrategyItemContainer/StrategyItemContainer.test.tsx @@ -0,0 +1,34 @@ +import { screen } from '@testing-library/react'; +import { render } from 'utils/testRenderer'; +import { StrategyItemContainer } from './StrategyItemContainer'; +import { IFeatureStrategy } from 'interfaces/strategy'; +import { testServerRoute, testServerSetup } from 'utils/testServer'; +import { UIProviderContainer } from '../../providers/UIProvider/UIProviderContainer'; + +const server = testServerSetup(); +testServerRoute(server, '/api/admin/ui-config', { + flags: { strategyImprovements: true }, +}); + +test('should render strategy name, custom title and description', async () => { + const strategy: IFeatureStrategy = { + id: 'irrelevant', + name: 'strategy name', + title: 'custom title', + constraints: [], + parameters: {}, + }; + + render( + + + + ); + + expect(screen.getByText('strategy name')).toBeInTheDocument(); + expect(screen.getByText('description')).toBeInTheDocument(); + await screen.findByText('custom title'); // behind async flag +}); diff --git a/frontend/src/component/common/StrategyItemContainer/StrategyItemContainer.tsx b/frontend/src/component/common/StrategyItemContainer/StrategyItemContainer.tsx index 77b722affb..55255af4b7 100644 --- a/frontend/src/component/common/StrategyItemContainer/StrategyItemContainer.tsx +++ b/frontend/src/component/common/StrategyItemContainer/StrategyItemContainer.tsx @@ -50,6 +50,13 @@ const StyledDescription = styled('div')(({ theme }) => ({ display: 'block', }, })); +const StyledCustomTitle = styled('div')(({ theme }) => ({ + fontWeight: 'normal', + display: 'none', + [theme.breakpoints.up('md')]: { + display: 'block', + }, +})); const StyledHeaderContainer = styled('div')({ flexDirection: 'column', justifyContent: 'center', @@ -141,11 +148,19 @@ export const StrategyItemContainer: FC = ({ + + {formatStrategyName(String(strategy.title))} + + } />