diff --git a/plugins/api-docs/src/components/ApiExplorerPage/DefaultApiExplorerPage.test.tsx b/plugins/api-docs/src/components/ApiExplorerPage/DefaultApiExplorerPage.test.tsx index f89897524d..e3723dba5b 100644 --- a/plugins/api-docs/src/components/ApiExplorerPage/DefaultApiExplorerPage.test.tsx +++ b/plugins/api-docs/src/components/ApiExplorerPage/DefaultApiExplorerPage.test.tsx @@ -168,7 +168,7 @@ describe('DefaultApiExplorerPage', () => { const { findByTitle, findByText } = await renderWrapped( , ); - expect(await findByText(/All \(1\)/)).toBeInTheDocument(); + expect(await findByText(/All apis \(1\)/)).toBeInTheDocument(); expect(await findByTitle(/View/)).toBeInTheDocument(); expect(await findByTitle(/View/)).toBeInTheDocument(); expect(await findByTitle(/Edit/)).toBeInTheDocument(); @@ -198,7 +198,7 @@ describe('DefaultApiExplorerPage', () => { const { findByTitle, findByText } = await renderWrapped( , ); - expect(await findByText(/All \(1\)/)).toBeInTheDocument(); + expect(await findByText(/All apis \(1\)/)).toBeInTheDocument(); expect(await findByTitle(/Foo Action/)).toBeInTheDocument(); expect(await findByTitle(/Bar Action/)).toBeInTheDocument(); expect((await findByTitle(/Bar Action/)).firstChild).toBeDisabled(); diff --git a/plugins/catalog/src/components/CatalogPage/DefaultCatalogPage.test.tsx b/plugins/catalog/src/components/CatalogPage/DefaultCatalogPage.test.tsx index 3411656426..485cb490d8 100644 --- a/plugins/catalog/src/components/CatalogPage/DefaultCatalogPage.test.tsx +++ b/plugins/catalog/src/components/CatalogPage/DefaultCatalogPage.test.tsx @@ -205,7 +205,9 @@ describe('DefaultCatalogPage', () => { it('should render the default actions of an item in the grid', async () => { await renderWrapped(); fireEvent.click(screen.getByTestId('user-picker-owned')); - await expect(screen.findByText(/Owned \(1\)/)).resolves.toBeInTheDocument(); + await expect( + screen.findByText(/Owned components \(1\)/), + ).resolves.toBeInTheDocument(); await expect(screen.findByTitle(/View/)).resolves.toBeInTheDocument(); await expect(screen.findByTitle(/Edit/)).resolves.toBeInTheDocument(); await expect( @@ -235,7 +237,9 @@ describe('DefaultCatalogPage', () => { await renderWrapped(); fireEvent.click(screen.getByTestId('user-picker-owned')); - await expect(screen.findByText(/Owned \(1\)/)).resolves.toBeInTheDocument(); + await expect( + screen.findByText(/Owned components \(1\)/), + ).resolves.toBeInTheDocument(); await expect(screen.findByTitle(/Foo Action/)).resolves.toBeInTheDocument(); await expect(screen.findByTitle(/Bar Action/)).resolves.toBeInTheDocument(); await expect( @@ -249,14 +253,20 @@ describe('DefaultCatalogPage', () => { it('should render', async () => { await renderWrapped(); fireEvent.click(screen.getByTestId('user-picker-owned')); - await expect(screen.findByText(/Owned \(1\)/)).resolves.toBeInTheDocument(); + await expect( + screen.findByText(/Owned components \(1\)/), + ).resolves.toBeInTheDocument(); fireEvent.click(screen.getByTestId('user-picker-all')); - await expect(screen.findByText(/All \(2\)/)).resolves.toBeInTheDocument(); + await expect( + screen.findByText(/All components \(2\)/), + ).resolves.toBeInTheDocument(); }, 20_000); it('should set initial filter correctly', async () => { await renderWrapped(); - await expect(screen.findByText(/All \(2\)/)).resolves.toBeInTheDocument(); + await expect( + screen.findByText(/All components \(2\)/), + ).resolves.toBeInTheDocument(); }, 20_000); // this test is for fixing the bug after favoriting an entity, the matching @@ -264,7 +274,9 @@ describe('DefaultCatalogPage', () => { it('should render the correct entities filtered on the selected filter', async () => { await renderWrapped(); fireEvent.click(screen.getByTestId('user-picker-owned')); - await expect(screen.findByText(/Owned \(1\)/)).resolves.toBeInTheDocument(); + await expect( + screen.findByText(/Owned components \(1\)/), + ).resolves.toBeInTheDocument(); // The "Starred" menu option should initially be disabled, since there // aren't any starred entities. expect(screen.getByTestId('user-picker-starred')).toHaveAttribute( @@ -272,11 +284,15 @@ describe('DefaultCatalogPage', () => { 'true', ); fireEvent.click(screen.getByTestId('user-picker-all')); - await expect(screen.findByText(/All \(2\)/)).resolves.toBeInTheDocument(); + await expect( + screen.findByText(/All components \(2\)/), + ).resolves.toBeInTheDocument(); const starredIcons = await screen.findAllByTitle('Add to favorites'); fireEvent.click(starredIcons[0]); - await expect(screen.findByText(/All \(2\)/)).resolves.toBeInTheDocument(); + await expect( + screen.findByText(/All components \(2\)/), + ).resolves.toBeInTheDocument(); // Now that we've starred an entity, the "Starred" menu option should be // enabled. @@ -286,7 +302,7 @@ describe('DefaultCatalogPage', () => { ); fireEvent.click(screen.getByTestId('user-picker-starred')); await expect( - screen.findByText(/Starred \(1\)/), + screen.findByText(/Starred components \(1\)/), ).resolves.toBeInTheDocument(); }, 20_000); diff --git a/plugins/catalog/src/components/CatalogTable/CatalogTable.tsx b/plugins/catalog/src/components/CatalogTable/CatalogTable.tsx index bddf7715bf..a8a513e2f4 100644 --- a/plugins/catalog/src/components/CatalogTable/CatalogTable.tsx +++ b/plugins/catalog/src/components/CatalogTable/CatalogTable.tsx @@ -228,6 +228,10 @@ export const CatalogTable = (props: CatalogTableProps) => { const showPagination = rows.length > 20; const currentKind = filters.kind?.value || ''; const currentType = filters.type?.value || ''; + const titleDisplay = [titlePreamble, currentType, currentKind] + .filter(s => s) + .join(' '); + return ( isLoading={loading} @@ -242,9 +246,7 @@ export const CatalogTable = (props: CatalogTableProps) => { pageSizeOptions: [20, 50, 100], ...tableOptions, }} - title={`${titlePreamble} ${currentType} ${currentKind}${ - currentKind ? 's' : '' - } (${entities.length})`} + title={`${titleDisplay}${currentKind ? 's' : ''} (${entities.length})`} data={rows} actions={actions || defaultActions} subtitle={subtitle}