update changelog and prettier fixups

Signed-off-by: Emma Indal <emma.indahl@gmail.com>
This commit is contained in:
Emma Indal
2022-02-04 15:17:37 +01:00
parent 308efff0ac
commit 0912186d16
3 changed files with 27 additions and 7 deletions
+1 -1
View File
@@ -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.
@@ -34,7 +34,16 @@ describe('<ErrorPage/>', () => {
it('should render with additional information including link', async () => {
const { getByText } = await renderInTestApp(
<ErrorPage status="404" statusMessage="PAGE NOT FOUND" additionalInfo={<>This is some additional information including <Link to="/test">a link</Link></>} />,
<ErrorPage
status="404"
statusMessage="PAGE NOT FOUND"
additionalInfo={
<>
This is some additional information including{' '}
<Link to="/test">a link</Link>
</>
}
/>,
);
expect(
getByText(/looks like someone dropped the mic!/i),
@@ -45,23 +54,33 @@ describe('<ErrorPage/>', () => {
it('should render with default support url if supportUrl is not provided', async () => {
const { getByText } = await renderInTestApp(
<ErrorPage status="404" statusMessage="PAGE NOT FOUND" />,
<ErrorPage status="404" statusMessage="PAGE NOT FOUND" />,
);
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(
<ErrorPage status="404" statusMessage="PAGE NOT FOUND" supportUrl='https://error-page-test-support-url.com' />,
<ErrorPage
status="404"
statusMessage="PAGE NOT FOUND"
supportUrl="https://error-page-test-support-url.com"
/>,
);
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',
);
});
});
@@ -89,7 +89,8 @@ export function ErrorPage(props: IErrorPageProps) {
<Link to="#" data-testid="go-back-link" onClick={() => navigate(-1)}>
Go back
</Link>
... or please <Link to={supportUrl || support.url}>contact support</Link> if you
... or please{' '}
<Link to={supportUrl || support.url}>contact support</Link> if you
think this is a bug.
</Typography>
</Grid>