mirror of
https://github.com/strapi/strapi.git
synced 2025-11-16 10:07:55 +00:00
fixed table displayed without assets or folders in BrowseStep + added a test case
This commit is contained in:
parent
775777fae2
commit
80626a65c8
@ -240,7 +240,7 @@ export const BrowseStep = ({
|
|||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{!isGridView && (
|
{!isGridView && (folderCount > 0 || assetCount > 0) && (
|
||||||
<TableList
|
<TableList
|
||||||
allowedTypes={allowedTypes}
|
allowedTypes={allowedTypes}
|
||||||
assetCount={assetCount}
|
assetCount={assetCount}
|
||||||
|
|||||||
@ -55,7 +55,7 @@ const FIXTURE_ASSETS = [
|
|||||||
const FIXTURE_FOLDERS = [
|
const FIXTURE_FOLDERS = [
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
createdAt: '',
|
createdAt: '2021-10-18T08:04:56.326Z',
|
||||||
pathId: 1,
|
pathId: 1,
|
||||||
name: 'Folder 1',
|
name: 'Folder 1',
|
||||||
children: {
|
children: {
|
||||||
@ -64,7 +64,7 @@ const FIXTURE_FOLDERS = [
|
|||||||
files: {
|
files: {
|
||||||
count: 1,
|
count: 1,
|
||||||
},
|
},
|
||||||
updatedAt: '',
|
updatedAt: '2021-10-18T08:04:56.326Z',
|
||||||
path: '/1',
|
path: '/1',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
@ -273,5 +273,13 @@ describe('BrowseStep', () => {
|
|||||||
expect(queryByText('Folders (1)')).not.toBeInTheDocument();
|
expect(queryByText('Folders (1)')).not.toBeInTheDocument();
|
||||||
expect(queryByText('Assets (1)')).not.toBeInTheDocument();
|
expect(queryByText('Assets (1)')).not.toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should not render table if no assets and folders', () => {
|
||||||
|
usePersistentState.mockReturnValueOnce([viewOptions.LIST]);
|
||||||
|
const { queryByRole, getByText } = setup({ folders: [] });
|
||||||
|
|
||||||
|
expect(queryByRole('gridcell', { name: /preview/i })).not.toBeInTheDocument();
|
||||||
|
expect(getByText('Upload your first assets...')).toBeInTheDocument();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -6,14 +6,14 @@ export const useFolders = jest.fn().mockReturnValue({
|
|||||||
children: {
|
children: {
|
||||||
count: 1,
|
count: 1,
|
||||||
},
|
},
|
||||||
createdAt: '',
|
createdAt: '2021-10-18T08:04:56.326Z',
|
||||||
files: {
|
files: {
|
||||||
count: 1,
|
count: 1,
|
||||||
},
|
},
|
||||||
parent: null,
|
parent: null,
|
||||||
path: '/1',
|
path: '/1',
|
||||||
pathId: 1,
|
pathId: 1,
|
||||||
updatedAt: '',
|
updatedAt: '2021-10-18T08:04:56.326Z',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user