diff --git a/src/components/__snapshots__/RepositoryNotifications.test.tsx.snap b/src/components/__snapshots__/RepositoryNotifications.test.tsx.snap index 31eacbd20..716b1ccc1 100644 --- a/src/components/__snapshots__/RepositoryNotifications.test.tsx.snap +++ b/src/components/__snapshots__/RepositoryNotifications.test.tsx.snap @@ -261,10 +261,10 @@ exports[`components/Repository.tsx should toggle account notifications visibilit class="text-gray-500 dark:text-gray-300" fill="currentColor" focusable="false" - height="12" + height="16" style="display: inline-block; user-select: none; vertical-align: text-bottom; overflow: visible;" viewBox="0 0 16 16" - width="12" + width="16" > { expect(tree).toMatchSnapshot(); }); - it('should render default icon when no url', () => { + it('should render default extra small icon when no url', () => { const props: IAvatarIcon = { defaultIcon: MarkGithubIcon, title: 'test', @@ -47,4 +47,26 @@ describe('components/icons/AvatarIcon.tsx', () => { const tree = render(); expect(tree).toMatchSnapshot(); }); + + it('should render default small icon when no url', () => { + const props: IAvatarIcon = { + defaultIcon: MarkGithubIcon, + title: 'test', + url: null, + size: Size.SMALL, + }; + const tree = render(); + expect(tree).toMatchSnapshot(); + }); + + it('should render default medium icon when no url', () => { + const props: IAvatarIcon = { + defaultIcon: MarkGithubIcon, + title: 'test', + url: null, + size: Size.MEDIUM, + }; + const tree = render(); + expect(tree).toMatchSnapshot(); + }); }); diff --git a/src/components/icons/AvatarIcon.tsx b/src/components/icons/AvatarIcon.tsx index 98c036103..7db4f4856 100644 --- a/src/components/icons/AvatarIcon.tsx +++ b/src/components/icons/AvatarIcon.tsx @@ -26,9 +26,12 @@ export const AvatarIcon: FC = (props: IAvatarIcon) => { ); } + const defaultIconSize = + props.size === Size.XSMALL ? 16 : props.size === Size.SMALL ? 20 : 24; + return ( ); diff --git a/src/components/icons/__snapshots__/AvatarIcon.test.tsx.snap b/src/components/icons/__snapshots__/AvatarIcon.test.tsx.snap index b659b6fe0..e114d0ee3 100644 --- a/src/components/icons/__snapshots__/AvatarIcon.test.tsx.snap +++ b/src/components/icons/__snapshots__/AvatarIcon.test.tsx.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`components/icons/AvatarIcon.tsx should render default icon when no url 1`] = ` +exports[`components/icons/AvatarIcon.tsx should render default extra small icon when no url 1`] = ` { "asFragment": [Function], "baseElement": @@ -10,10 +10,10 @@ exports[`components/icons/AvatarIcon.tsx should render default icon when no url class="text-gray-500 dark:text-gray-300" fill="currentColor" focusable="false" - height="12" + height="16" style="display: inline-block; user-select: none; vertical-align: text-bottom; overflow: visible;" viewBox="0 0 16 16" - width="12" + width="16" > + + + , + "debug": [Function], + "findAllByAltText": [Function], + "findAllByDisplayValue": [Function], + "findAllByLabelText": [Function], + "findAllByPlaceholderText": [Function], + "findAllByRole": [Function], + "findAllByTestId": [Function], + "findAllByText": [Function], + "findAllByTitle": [Function], + "findByAltText": [Function], + "findByDisplayValue": [Function], + "findByLabelText": [Function], + "findByPlaceholderText": [Function], + "findByRole": [Function], + "findByTestId": [Function], + "findByText": [Function], + "findByTitle": [Function], + "getAllByAltText": [Function], + "getAllByDisplayValue": [Function], + "getAllByLabelText": [Function], + "getAllByPlaceholderText": [Function], + "getAllByRole": [Function], + "getAllByTestId": [Function], + "getAllByText": [Function], + "getAllByTitle": [Function], + "getByAltText": [Function], + "getByDisplayValue": [Function], + "getByLabelText": [Function], + "getByPlaceholderText": [Function], + "getByRole": [Function], + "getByTestId": [Function], + "getByText": [Function], + "getByTitle": [Function], + "queryAllByAltText": [Function], + "queryAllByDisplayValue": [Function], + "queryAllByLabelText": [Function], + "queryAllByPlaceholderText": [Function], + "queryAllByRole": [Function], + "queryAllByTestId": [Function], + "queryAllByText": [Function], + "queryAllByTitle": [Function], + "queryByAltText": [Function], + "queryByDisplayValue": [Function], + "queryByLabelText": [Function], + "queryByPlaceholderText": [Function], + "queryByRole": [Function], + "queryByTestId": [Function], + "queryByText": [Function], + "queryByTitle": [Function], + "rerender": [Function], + "unmount": [Function], +} +`; + +exports[`components/icons/AvatarIcon.tsx should render default medium icon when no url 1`] = ` +{ + "asFragment": [Function], + "baseElement": +
+ +
+ , + "container":
+ +
, + "debug": [Function], + "findAllByAltText": [Function], + "findAllByDisplayValue": [Function], + "findAllByLabelText": [Function], + "findAllByPlaceholderText": [Function], + "findAllByRole": [Function], + "findAllByTestId": [Function], + "findAllByText": [Function], + "findAllByTitle": [Function], + "findByAltText": [Function], + "findByDisplayValue": [Function], + "findByLabelText": [Function], + "findByPlaceholderText": [Function], + "findByRole": [Function], + "findByTestId": [Function], + "findByText": [Function], + "findByTitle": [Function], + "getAllByAltText": [Function], + "getAllByDisplayValue": [Function], + "getAllByLabelText": [Function], + "getAllByPlaceholderText": [Function], + "getAllByRole": [Function], + "getAllByTestId": [Function], + "getAllByText": [Function], + "getAllByTitle": [Function], + "getByAltText": [Function], + "getByDisplayValue": [Function], + "getByLabelText": [Function], + "getByPlaceholderText": [Function], + "getByRole": [Function], + "getByTestId": [Function], + "getByText": [Function], + "getByTitle": [Function], + "queryAllByAltText": [Function], + "queryAllByDisplayValue": [Function], + "queryAllByLabelText": [Function], + "queryAllByPlaceholderText": [Function], + "queryAllByRole": [Function], + "queryAllByTestId": [Function], + "queryAllByText": [Function], + "queryAllByTitle": [Function], + "queryByAltText": [Function], + "queryByDisplayValue": [Function], + "queryByLabelText": [Function], + "queryByPlaceholderText": [Function], + "queryByRole": [Function], + "queryByTestId": [Function], + "queryByText": [Function], + "queryByTitle": [Function], + "rerender": [Function], + "unmount": [Function], +} +`; + +exports[`components/icons/AvatarIcon.tsx should render default small icon when no url 1`] = ` +{ + "asFragment": [Function], + "baseElement": +
+ +
+ , + "container":
+