diff --git a/front/src/components/chips/PersonChip.tsx b/front/src/components/chips/PersonChip.tsx index 08ed43690..e92923a87 100644 --- a/front/src/components/chips/PersonChip.tsx +++ b/front/src/components/chips/PersonChip.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import styled from '@emotion/styled'; -import personPlaceholder from './placeholder.png'; +import PersonPlaceholder from './person-placeholder.png'; type OwnProps = { name: string; @@ -29,12 +29,11 @@ const StyledContainer = styled.span` `; function PersonChip({ name, picture }: OwnProps) { - console.log(picture ? picture.toString() : personPlaceholder); return ( person-picture {name} diff --git a/front/src/components/chips/__stories__/PersonChip.tsx b/front/src/components/chips/__stories__/PersonChip.tsx new file mode 100644 index 000000000..22466a2b0 --- /dev/null +++ b/front/src/components/chips/__stories__/PersonChip.tsx @@ -0,0 +1,24 @@ +import { ThemeProvider } from '@emotion/react'; +import { lightTheme } from '../../../layout/styles/themes'; +import PersonChip from '../PersonChip'; + +export default { + title: 'PersonChip', + component: PersonChip, +}; + +export const RegularPersonChip = () => { + return ( + + + + ); +}; + +export const RegularPersonChipWithImage = () => { + return ( + + + + ); +}; diff --git a/front/src/components/chips/__tests__/PersonChip.test.tsx b/front/src/components/chips/__tests__/PersonChip.test.tsx new file mode 100644 index 000000000..2c2a0b922 --- /dev/null +++ b/front/src/components/chips/__tests__/PersonChip.test.tsx @@ -0,0 +1,22 @@ +import { render } from '@testing-library/react'; + +import { + RegularPersonChip, + RegularPersonChipWithImage, +} from '../__stories__/PersonChip'; + +it('Checks the PersonChip renders', () => { + const { getByText, getByTestId } = render(); + + expect(getByText('selected-company-1')).toBeDefined(); + expect(getByTestId('person-chip-image')).toHaveAttribute( + 'src', + 'person-placeholder.png', + ); +}); + +it('Checks the PersonChip img renders', () => { + const { getByTestId } = render(); + + expect(getByTestId('person-chip-image')).toHaveAttribute('src', 'coucou.fr'); +}); diff --git a/front/src/components/chips/placeholder.png b/front/src/components/chips/person-placeholder.png similarity index 100% rename from front/src/components/chips/placeholder.png rename to front/src/components/chips/person-placeholder.png