Merge pull request #32172 from Ferin79/master
fix: Added title prop to OffsetPaginatedDocsTable for proper display
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-techdocs': patch
|
||||
---
|
||||
|
||||
Added title prop to OffsetPaginatedDocsTable for proper display
|
||||
@@ -52,6 +52,8 @@ describe('OffsetPaginatedDocsTable', () => {
|
||||
},
|
||||
];
|
||||
|
||||
const tableTitle = 'All Docs';
|
||||
|
||||
const wrapInContext = (
|
||||
node: ReactNode,
|
||||
value?: Partial<EntityListContextProps<DefaultEntityFilters>>,
|
||||
@@ -66,7 +68,11 @@ describe('OffsetPaginatedDocsTable', () => {
|
||||
it('should display all the items', async () => {
|
||||
await renderInTestApp(
|
||||
wrapInContext(
|
||||
<OffsetPaginatedDocsTable data={data} columns={columns} />,
|
||||
<OffsetPaginatedDocsTable
|
||||
data={data}
|
||||
columns={columns}
|
||||
title={tableTitle}
|
||||
/>,
|
||||
{
|
||||
setOffset: jest.fn(),
|
||||
limit: Number.MAX_SAFE_INTEGER,
|
||||
@@ -76,6 +82,8 @@ describe('OffsetPaginatedDocsTable', () => {
|
||||
),
|
||||
);
|
||||
|
||||
expect(screen.getByText(tableTitle)).toBeInTheDocument();
|
||||
|
||||
for (const item of data) {
|
||||
expect(screen.queryByText(item.entity.metadata.name)).toBeInTheDocument();
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ import {
|
||||
* @internal
|
||||
*/
|
||||
export function OffsetPaginatedDocsTable(props: TableProps<DocsTableRow>) {
|
||||
const { actions, columns, data, isLoading, options } = props;
|
||||
const { actions, columns, data, isLoading, options, title } = props;
|
||||
const { updateFilters, setLimit, setOffset, limit, totalItems, offset } =
|
||||
useEntityList();
|
||||
const [page, setPage] = useState(
|
||||
@@ -44,6 +44,7 @@ export function OffsetPaginatedDocsTable(props: TableProps<DocsTableRow>) {
|
||||
|
||||
return (
|
||||
<Table<DocsTableRow>
|
||||
title={title}
|
||||
columns={columns}
|
||||
data={data}
|
||||
options={{
|
||||
|
||||
Reference in New Issue
Block a user