Improve tests (#871)
This commit is contained in:
@ -3,7 +3,7 @@ import { Meta, StoryObj } from '@storybook/react';
|
||||
|
||||
import { EntityBoard } from '@/pipeline/components/EntityBoard';
|
||||
import { opportunitiesBoardOptions } from '~/pages/opportunities/opportunitiesBoardOptions';
|
||||
import { ComponentDecorator } from '~/testing/decorators';
|
||||
import { ComponentDecorator } from '~/testing/decorators/ComponentDecorator';
|
||||
import { graphqlMocks } from '~/testing/graphqlMocks';
|
||||
|
||||
import { defaultPipelineProgressOrderBy } from '../../pipeline/queries';
|
||||
|
||||
@ -3,7 +3,7 @@ import { MemoryRouter } from 'react-router-dom';
|
||||
import { Meta, StoryObj } from '@storybook/react';
|
||||
|
||||
import { CompanyBoardCard } from '@/companies/components/CompanyBoardCard';
|
||||
import { ComponentDecorator } from '~/testing/decorators';
|
||||
import { ComponentDecorator } from '~/testing/decorators/ComponentDecorator';
|
||||
import { graphqlMocks } from '~/testing/graphqlMocks';
|
||||
import { mockedPipelineProgressData } from '~/testing/mock-data/pipeline-progress';
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@ import { BrowserRouter } from 'react-router-dom';
|
||||
import styled from '@emotion/styled';
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
|
||||
import { ComponentDecorator } from '~/testing/decorators';
|
||||
import { ComponentDecorator } from '~/testing/decorators/ComponentDecorator';
|
||||
|
||||
import { CompanyChip } from '../components/CompanyChip';
|
||||
|
||||
@ -37,14 +37,13 @@ const TestCellContainer = styled.div`
|
||||
min-width: 250px;
|
||||
|
||||
overflow: hidden;
|
||||
text-wrap: nowrap;
|
||||
`;
|
||||
|
||||
export const SmallName: Story = {
|
||||
args: {
|
||||
id: 'airbnb',
|
||||
name: 'Airbnb',
|
||||
picture: 'https://api.faviconkit.com/airbnb.com/144',
|
||||
pictureUrl: 'https://api.faviconkit.com/airbnb.com/144',
|
||||
},
|
||||
};
|
||||
|
||||
@ -56,6 +55,6 @@ export const BigName: Story = {
|
||||
args: {
|
||||
id: 'google',
|
||||
name: 'Google with a real big name to overflow the cell',
|
||||
picture: 'https://api.faviconkit.com/google.com/144',
|
||||
pictureUrl: 'https://api.faviconkit.com/google.com/144',
|
||||
},
|
||||
};
|
||||
|
||||
@ -41,7 +41,7 @@ export function CompanyAccountOwnerCell({ company }: OwnProps) {
|
||||
<PersonChip
|
||||
id={company.accountOwner.id}
|
||||
name={company.accountOwner?.displayName ?? ''}
|
||||
picture={company.accountOwner?.avatarUrl ?? ''}
|
||||
pictureUrl={company.accountOwner?.avatarUrl ?? ''}
|
||||
/>
|
||||
) : (
|
||||
<></>
|
||||
|
||||
@ -10,7 +10,6 @@ import { GET_PIPELINE_PROGRESS, GET_PIPELINES } from '@/pipeline/queries';
|
||||
import { BoardCardContext } from '@/pipeline/states/BoardCardContext';
|
||||
import { pipelineProgressIdScopedState } from '@/pipeline/states/pipelineProgressIdScopedState';
|
||||
import { selectedBoardCardsState } from '@/pipeline/states/selectedBoardCardsState';
|
||||
import { ChipVariant } from '@/ui/chip/components/EntityChip';
|
||||
import { DateEditableField } from '@/ui/editable-field/variants/components/DateEditableField';
|
||||
import { NumberEditableField } from '@/ui/editable-field/variants/components/NumberEditableField';
|
||||
import { IconCurrencyDollar, IconProgressCheck } from '@/ui/icon';
|
||||
@ -177,9 +176,8 @@ export function CompanyBoardCard() {
|
||||
<CompanyChip
|
||||
id={company.id}
|
||||
name={company.name}
|
||||
clickable
|
||||
picture={getLogoUrlFromDomainName(company.domainName)}
|
||||
variant={ChipVariant.transparent}
|
||||
pictureUrl={getLogoUrlFromDomainName(company.domainName)}
|
||||
clickable={false}
|
||||
/>
|
||||
<StyledCheckboxContainer className="checkbox-container">
|
||||
<Checkbox
|
||||
|
||||
@ -1,29 +1,25 @@
|
||||
import { ChipVariant, EntityChip } from '@/ui/chip/components/EntityChip';
|
||||
import { EntityChip } from '@/ui/chip/components/EntityChip';
|
||||
|
||||
type OwnProps = {
|
||||
id: string;
|
||||
name: string;
|
||||
picture?: string;
|
||||
pictureUrl?: string;
|
||||
clickable?: boolean;
|
||||
variant?: ChipVariant;
|
||||
};
|
||||
|
||||
export function CompanyChip({
|
||||
id,
|
||||
name,
|
||||
picture,
|
||||
clickable,
|
||||
variant = ChipVariant.opaque,
|
||||
pictureUrl,
|
||||
clickable = true,
|
||||
}: OwnProps) {
|
||||
return (
|
||||
<EntityChip
|
||||
entityId={id}
|
||||
linkToEntity={`/companies/${id}`}
|
||||
linkToEntity={clickable ? `/companies/${id}` : undefined}
|
||||
name={name}
|
||||
avatarType="squared"
|
||||
clickable={clickable}
|
||||
picture={picture}
|
||||
variant={variant}
|
||||
pictureUrl={pictureUrl}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@ -38,7 +38,7 @@ export function CompanyEditableNameChipCell({ company }: OwnProps) {
|
||||
id={company.id}
|
||||
name={company.name}
|
||||
clickable
|
||||
picture={getLogoUrlFromDomainName(company.domainName)}
|
||||
pictureUrl={getLogoUrlFromDomainName(company.domainName)}
|
||||
/>
|
||||
}
|
||||
onSubmit={() =>
|
||||
|
||||
@ -31,7 +31,7 @@ export function CompanyAccountOwnerEditableField({ company }: OwnProps) {
|
||||
<PersonChip
|
||||
id={company.accountOwner.id}
|
||||
name={company.accountOwner?.displayName ?? ''}
|
||||
picture={company.accountOwner?.avatarUrl ?? ''}
|
||||
pictureUrl={company.accountOwner?.avatarUrl ?? ''}
|
||||
/>
|
||||
) : (
|
||||
<></>
|
||||
|
||||
Reference in New Issue
Block a user