Address comments

This commit is contained in:
Fredrik Adelöw
2020-06-28 20:48:11 +02:00
parent 52e784f651
commit 963648eeb7
3 changed files with 17 additions and 14 deletions
@@ -16,7 +16,7 @@
import { Entity } from '@backstage/catalog-model';
import { wrapInTestApp } from '@backstage/test-utils';
import { render, waitFor } from '@testing-library/react';
import { render } from '@testing-library/react';
import * as React from 'react';
import { CatalogTable } from './CatalogTable';
@@ -66,11 +66,9 @@ describe('CatalogTable component', () => {
/>,
),
);
waitFor(() => {
expect(rendered.queryByText(/Owned \(3\)/)).toBeInTheDocument();
expect(rendered.queryByText(/component1/)).toBeInTheDocument();
expect(rendered.queryByText(/component2/)).toBeInTheDocument();
expect(rendered.queryByText(/component3/)).toBeInTheDocument();
});
expect(rendered.getByText(/Owned \(3\)/)).toBeInTheDocument();
expect(rendered.getByText(/component1/)).toBeInTheDocument();
expect(rendered.getByText(/component2/)).toBeInTheDocument();
expect(rendered.getByText(/component3/)).toBeInTheDocument();
});
});
@@ -92,7 +92,7 @@ export const CatalogTable = ({
(rowData: Entity) => {
const location = findLocationForEntityMeta(rowData.metadata);
return {
icon: GitHub,
icon: () => <GitHub fontSize="small" />,
tooltip: 'View on GitHub',
onClick: () => {
if (!location) return;
@@ -112,9 +112,8 @@ export const CatalogTable = ({
};
const location = findLocationForEntityMeta(rowData.metadata);
return {
icon: Edit,
icon: () => <Edit fontSize="small" />,
tooltip: 'Edit',
// iconProps: { size: 'small' },
onClick: () => {
if (!location) return;
window.open(createEditLink(location), '_blank');
@@ -125,7 +124,13 @@ export const CatalogTable = ({
(rowData: Entity) => {
const isStarred = isStarredEntity(rowData);
return {
icon: isStarred ? () => <Star htmlColor="#f3ba37" /> : StarOutline,
cellStyle: { paddingLeft: '1em' },
icon: () =>
isStarred ? (
<Star htmlColor="#f3ba37" fontSize="small" />
) : (
<StarOutline fontSize="small" />
),
tooltip: isStarred ? 'Remove from favorites' : 'Add to favorites',
onClick: () => toggleStarredEntity(rowData),
};