mirror of
				https://github.com/strapi/strapi.git
				synced 2025-11-03 19:36:20 +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>
 | 
			
		||||
      )}
 | 
			
		||||
 | 
			
		||||
      {!isGridView && (
 | 
			
		||||
      {!isGridView && (folderCount > 0 || assetCount > 0) && (
 | 
			
		||||
        <TableList
 | 
			
		||||
          allowedTypes={allowedTypes}
 | 
			
		||||
          assetCount={assetCount}
 | 
			
		||||
 | 
			
		||||
@ -55,7 +55,7 @@ const FIXTURE_ASSETS = [
 | 
			
		||||
const FIXTURE_FOLDERS = [
 | 
			
		||||
  {
 | 
			
		||||
    id: 1,
 | 
			
		||||
    createdAt: '',
 | 
			
		||||
    createdAt: '2021-10-18T08:04:56.326Z',
 | 
			
		||||
    pathId: 1,
 | 
			
		||||
    name: 'Folder 1',
 | 
			
		||||
    children: {
 | 
			
		||||
@ -64,7 +64,7 @@ const FIXTURE_FOLDERS = [
 | 
			
		||||
    files: {
 | 
			
		||||
      count: 1,
 | 
			
		||||
    },
 | 
			
		||||
    updatedAt: '',
 | 
			
		||||
    updatedAt: '2021-10-18T08:04:56.326Z',
 | 
			
		||||
    path: '/1',
 | 
			
		||||
  },
 | 
			
		||||
];
 | 
			
		||||
@ -273,5 +273,13 @@ describe('BrowseStep', () => {
 | 
			
		||||
      expect(queryByText('Folders (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: {
 | 
			
		||||
        count: 1,
 | 
			
		||||
      },
 | 
			
		||||
      createdAt: '',
 | 
			
		||||
      createdAt: '2021-10-18T08:04:56.326Z',
 | 
			
		||||
      files: {
 | 
			
		||||
        count: 1,
 | 
			
		||||
      },
 | 
			
		||||
      parent: null,
 | 
			
		||||
      path: '/1',
 | 
			
		||||
      pathId: 1,
 | 
			
		||||
      updatedAt: '',
 | 
			
		||||
      updatedAt: '2021-10-18T08:04:56.326Z',
 | 
			
		||||
    },
 | 
			
		||||
  ],
 | 
			
		||||
  isLoading: false,
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user