@@ -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} />
|
||||
```
|
||||
|
||||
@@ -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;
|
||||
@@ -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: [
|
||||
|
||||
Reference in New Issue
Block a user