update changelog and prettier fixups
Signed-off-by: Emma Indal <emma.indahl@gmail.com>
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user