Skip to content

Commit

Permalink
test and description
Browse files Browse the repository at this point in the history
Signed-off-by: Ladislav Vitásek <[email protected]>
  • Loading branch information
Vity01 committed Oct 2, 2024
1 parent 9b38e91 commit 1845810
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
7 changes: 6 additions & 1 deletion .changeset/tricky-shoes-lie.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,9 @@
'@backstage/plugin-catalog-graph': patch
---

Added Action attribute for CatalogGraphCard
Added InfoCard `action` attribute for CatalogGraphCard

```tsx
const action = <Button title="Action Button" onClick={handleClickEvent()} />
<CatalogGraphCard action={action} />
```
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import userEvent from '@testing-library/user-event';
import React from 'react';
import { catalogGraphRouteRef } from '../../routes';
import { CatalogGraphCard } from './CatalogGraphCard';
import Button from '@material-ui/core/Button';

describe('<CatalogGraphCard/>', () => {
let entity: Entity;
Expand Down Expand Up @@ -127,6 +128,33 @@ describe('<CatalogGraphCard/>', () => {
expect(await screen.findByText('Custom Title')).toBeInTheDocument();
});

test('renders with action attribute', async () => {
catalog.getEntitiesByRefs.mockImplementation(async _ => ({
items: [
{
...entity,
relations: [],
},
],
}));

await renderInTestApp(
<ApiProvider apis={apis}>
<EntityProvider entity={entity}>
<CatalogGraphCard action={<Button title="Action Button" />} />
</EntityProvider>
</ApiProvider>,
{
mountedRoutes: {
'/entity/{kind}/{namespace}/{name}': entityRouteRef,
'/catalog-graph': catalogGraphRouteRef,
},
},
);

expect(await screen.findByText('Action Button')).toBeInTheDocument();
});

test('renders link to standalone viewer', async () => {
catalog.getEntitiesByRefs.mockImplementation(async _ => ({
items: [
Expand Down

0 comments on commit 1845810

Please sign in to comment.