ML: Hide bulk actions if not assets or folders exist

This commit is contained in:
Gustav Hansen 2022-07-29 12:34:25 +02:00
parent 06694ec71d
commit d67128ed9f
2 changed files with 19 additions and 1 deletions

View File

@ -161,7 +161,7 @@ export const MediaLibrary = () => {
<ActionLayout
startActions={
<>
{canUpdate && (
{canUpdate && (assetCount > 0 || folderCount > 0) && (
<BoxWithHeight
paddingLeft={2}
paddingRight={2}

View File

@ -210,6 +210,24 @@ describe('Media library homepage', () => {
});
describe('select all', () => {
it('is not visible if there are not folders and assets', () => {
useAssets.mockReturnValueOnce({
isLoading: false,
error: null,
data: {},
});
useFolders.mockReturnValueOnce({
data: [],
isLoading: false,
error: null,
});
renderML();
expect(
screen.queryByText('There are no elements with the applied filters')
).not.toBeInTheDocument();
});
it('shows the select all button when the user is allowed to update', () => {
renderML();