1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-05-03 01:18:43 +02:00
unleash.unleash/frontend/src/component/playground/Playground/AdvancedPlaygroundResultsTable/AdvancedPlaygroundResultsTable.test.tsx
Thomas Heartman 2010b512e0
a11y: change the playground diff link to be a button. (#4274)
This is both more correct in terms of what it does and also fixes an
issue where you couldn't navigate to the diff preview with the
keyboard previously.

It looks exactly the same as before except there's an additional
paddingless button when you hover/focus it.
2023-07-18 15:05:29 +02:00

115 lines
5.8 KiB
TypeScript

import { screen } from '@testing-library/react';
import { render } from 'utils/testRenderer';
import { UIProviderContainer } from 'component/providers/UIProvider/UIProviderContainer';
import { AdvancedPlaygroundResultsTable } from './AdvancedPlaygroundResultsTable';
test('should render advanced playground table', async () => {
render(
<UIProviderContainer>
<AdvancedPlaygroundResultsTable
loading={false}
features={[
{
name: 'Infinite',
projectId: 'ChangeReqs',
environments: {
development: [
{
isEnabled: false,
isEnabledInCurrentEnvironment: false,
strategies: {
result: true,
data: [
{
name: 'flexibleRollout',
id: '45971fe0-1122-40a7-a68c-3a1430c44062',
disabled: false,
parameters: {
groupId: 'Infinite',
rollout: '50',
stickiness: 'default',
},
result: {
enabled: true,
evaluationStatus:
'complete',
},
constraints: [],
segments: [],
links: {
edit: '/projects/ChangeReqs/features/Infinite/strategies/edit?environmenId=development&strategyId=45971fe0-1122-40a7-a68c-3a1430c44062',
},
},
{
name: 'default',
id: 'bf5e35b6-edc1-4e54-8f7e-a6cc8d4f352a',
disabled: false,
parameters: {},
result: {
enabled: true,
evaluationStatus:
'complete',
},
constraints: [],
segments: [],
links: {
edit: '/projects/ChangeReqs/features/Infinite/strategies/edit?environmenId=development&strategyId=bf5e35b6-edc1-4e54-8f7e-a6cc8d4f352a',
},
},
],
},
projectId: 'ChangeReqs',
variant: {
name: 'disabled',
enabled: false,
},
name: 'Infinite',
environment: 'development',
context: {
appName: 'MyApp',
},
variants: [],
},
],
production: [
{
isEnabled: false,
isEnabledInCurrentEnvironment: false,
strategies: {
result: false,
data: [],
},
projectId: 'ChangeReqs',
variant: {
name: 'disabled',
enabled: false,
},
name: 'Infinite',
environment: 'production',
context: {
appName: 'MyApp',
},
variants: [],
},
],
},
},
]}
input={{
environments: ['development', 'production'],
projects: '*',
context: {
appName: 'MyApp',
},
}}
/>
</UIProviderContainer>
);
expect(screen.getByText('Infinite')).toBeInTheDocument();
expect(screen.getByText('ChangeReqs')).toBeInTheDocument();
expect(screen.getByText('Development')).toBeInTheDocument();
expect(screen.getByText('Production')).toBeInTheDocument();
expect(screen.getByText('View diff')).toBeInTheDocument();
});