Skip to content

Commit

Permalink
Merge pull request #4898 from niallmccullagh/master
Browse files Browse the repository at this point in the history
Fix issue with radar description dialog display
  • Loading branch information
freben committed Mar 16, 2021
2 parents 21029b5 + b56815b commit ac08d81
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/cyan-rings-live.md
@@ -0,0 +1,5 @@
---
'@backstage/plugin-tech-radar': patch
---

Fixes issue where radar description dialog is not shown when the entry has an url external to the radar page
16 changes: 16 additions & 0 deletions plugins/tech-radar/src/components/RadarEntry/RadarEntry.test.tsx
Expand Up @@ -79,4 +79,20 @@ describe('RadarEntry', () => {
expect(radarDescription).toBeInTheDocument();
expect(screen.getByText(String(minProps.value))).toBeInTheDocument();
});

it('should render blip with url equal to # if description present', () => {
const withUrl = {
...optionalProps,
url: 'http://backstage.io',
};
render(
<ThemeProvider theme={lightTheme}>
<svg>
<RadarEntry {...withUrl} />
</svg>
</ThemeProvider>,
);

expect(screen.getByRole('button')).toHaveAttribute('href', '#');
});
});
3 changes: 2 additions & 1 deletion plugins/tech-radar/src/components/RadarEntry/RadarEntry.tsx
Expand Up @@ -111,11 +111,12 @@ const RadarEntry = (props: Props): JSX.Element => {
/>
)}
{description ? (
// eslint-disable-next-line jsx-a11y/anchor-is-valid
<a
className={classes.link}
onClick={handleClickOpen}
href={url ? url : '#'}
role="button"
href="#"
tabIndex={0}
onKeyPress={toggle}
>
Expand Down
4 changes: 3 additions & 1 deletion plugins/tech-radar/src/sampleData.ts
Expand Up @@ -72,9 +72,11 @@ entries.push({
moved: 1,
ringId: 'use',
date: new Date('2020-08-06'),
description:
'Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur',
},
],
url: '#',
url: 'https://webpack.js.org/',
key: 'webpack',
id: 'webpack',
title: 'Webpack',
Expand Down

0 comments on commit ac08d81

Please sign in to comment.