From 0912186d16154c59fedf56a3eeff0096a9fa5828 Mon Sep 17 00:00:00 2001 From: Emma Indal Date: Fri, 4 Feb 2022 15:17:37 +0100 Subject: [PATCH] update changelog and prettier fixups Signed-off-by: Emma Indal --- .changeset/khaki-jokes-grab.md | 2 +- .../src/layout/ErrorPage/ErrorPage.test.tsx | 29 +++++++++++++++---- .../src/layout/ErrorPage/ErrorPage.tsx | 3 +- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/.changeset/khaki-jokes-grab.md b/.changeset/khaki-jokes-grab.md index 967ed1e0e4..e94a580e58 100644 --- a/.changeset/khaki-jokes-grab.md +++ b/.changeset/khaki-jokes-grab.md @@ -2,4 +2,4 @@ '@backstage/core-components': patch --- -Accept JSX Element as additionalInfo property of ErrorPage component +Adjust ErrorPage to accept optional supportUrl property to override app config and JSX Element as additionalInfo property. diff --git a/packages/core-components/src/layout/ErrorPage/ErrorPage.test.tsx b/packages/core-components/src/layout/ErrorPage/ErrorPage.test.tsx index d6ef392f76..57d0ba34a1 100644 --- a/packages/core-components/src/layout/ErrorPage/ErrorPage.test.tsx +++ b/packages/core-components/src/layout/ErrorPage/ErrorPage.test.tsx @@ -34,7 +34,16 @@ describe('', () => { it('should render with additional information including link', async () => { const { getByText } = await renderInTestApp( - This is some additional information including a link} />, + + This is some additional information including{' '} + a link + + } + />, ); expect( getByText(/looks like someone dropped the mic!/i), @@ -45,23 +54,33 @@ describe('', () => { it('should render with default support url if supportUrl is not provided', async () => { const { getByText } = await renderInTestApp( - , + , ); expect( getByText(/looks like someone dropped the mic!/i), ).toBeInTheDocument(); expect(getByText(/contact support/i)).toBeInTheDocument(); - expect(getByText(/contact support/i)).toHaveAttribute('href', 'https://github.com/backstage/backstage/issues'); + expect(getByText(/contact support/i)).toHaveAttribute( + 'href', + 'https://github.com/backstage/backstage/issues', + ); }); it('should override support url if supportUrl property is provided', async () => { const { getByText } = await renderInTestApp( - , + , ); expect( getByText(/looks like someone dropped the mic!/i), ).toBeInTheDocument(); expect(getByText(/contact support/i)).toBeInTheDocument(); - expect(getByText(/contact support/i)).toHaveAttribute('href', 'https://error-page-test-support-url.com'); + expect(getByText(/contact support/i)).toHaveAttribute( + 'href', + 'https://error-page-test-support-url.com', + ); }); }); diff --git a/packages/core-components/src/layout/ErrorPage/ErrorPage.tsx b/packages/core-components/src/layout/ErrorPage/ErrorPage.tsx index cae8f95ec8..27d884684b 100644 --- a/packages/core-components/src/layout/ErrorPage/ErrorPage.tsx +++ b/packages/core-components/src/layout/ErrorPage/ErrorPage.tsx @@ -89,7 +89,8 @@ export function ErrorPage(props: IErrorPageProps) { navigate(-1)}> Go back - ... or please contact support if you + ... or please{' '} + contact support if you think this is a bug.