mirror of
https://github.com/strapi/strapi.git
synced 2025-11-12 16:22:10 +00:00
Merge pull request #15243 from strapi/fix/ML-header-tooltip-and-asset-count
[fix] ML table headers and asset count
This commit is contained in:
commit
f488558cd0
@ -250,11 +250,11 @@ describe('BrowseStep', () => {
|
|||||||
it('should render the table headers', () => {
|
it('should render the table headers', () => {
|
||||||
usePersistentState.mockReturnValueOnce([viewOptions.LIST]);
|
usePersistentState.mockReturnValueOnce([viewOptions.LIST]);
|
||||||
|
|
||||||
const { getByText } = setup();
|
const { getByText, getByRole } = setup();
|
||||||
expect(getByText('preview')).toBeInTheDocument();
|
expect(getByRole('gridcell', { name: 'preview' })).toBeInTheDocument();
|
||||||
expect(getByText('name')).toBeInTheDocument();
|
expect(getByText('name')).toBeInTheDocument();
|
||||||
expect(getByText('extension')).toBeInTheDocument();
|
expect(getByRole('gridcell', { name: 'extension' })).toBeInTheDocument();
|
||||||
expect(getByText('size')).toBeInTheDocument();
|
expect(getByRole('gridcell', { name: 'size' })).toBeInTheDocument();
|
||||||
expect(getByText('created')).toBeInTheDocument();
|
expect(getByText('created')).toBeInTheDocument();
|
||||||
expect(getByText('last update')).toBeInTheDocument();
|
expect(getByText('last update')).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|||||||
@ -80,8 +80,8 @@ export const TableList = ({
|
|||||||
}
|
}
|
||||||
key={key}
|
key={key}
|
||||||
>
|
>
|
||||||
|
<Tooltip label={isSortable ? sortLabel : tableHeaderLabel}>
|
||||||
{isSortable ? (
|
{isSortable ? (
|
||||||
<Tooltip label={sortLabel}>
|
|
||||||
<Typography
|
<Typography
|
||||||
onClick={() => handleClickSort(isSorted, name)}
|
onClick={() => handleClickSort(isSorted, name)}
|
||||||
as={isSorted ? 'span' : 'button'}
|
as={isSorted ? 'span' : 'button'}
|
||||||
@ -91,12 +91,12 @@ export const TableList = ({
|
|||||||
>
|
>
|
||||||
{tableHeaderLabel}
|
{tableHeaderLabel}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Tooltip>
|
|
||||||
) : (
|
) : (
|
||||||
<Typography textColor="neutral600" variant="sigma">
|
<Typography textColor="neutral600" variant="sigma">
|
||||||
{tableHeaderLabel}
|
{tableHeaderLabel}
|
||||||
</Typography>
|
</Typography>
|
||||||
)}
|
)}
|
||||||
|
</Tooltip>
|
||||||
</Th>
|
</Th>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|||||||
@ -61,13 +61,13 @@ const ComponentFixture = (props) => {
|
|||||||
const setup = (props) => render(<ComponentFixture {...props} />);
|
const setup = (props) => render(<ComponentFixture {...props} />);
|
||||||
|
|
||||||
describe('TableList', () => {
|
describe('TableList', () => {
|
||||||
it('should render table headers labels', () => {
|
it.only('should render table headers labels', () => {
|
||||||
const { getByText } = setup();
|
const { getByText, getByRole } = setup();
|
||||||
|
|
||||||
expect(getByText('preview')).toBeInTheDocument();
|
expect(getByRole('gridcell', { name: 'preview' })).toBeInTheDocument();
|
||||||
expect(getByText('name')).toBeInTheDocument();
|
expect(getByText('name')).toBeInTheDocument();
|
||||||
expect(getByText('extension')).toBeInTheDocument();
|
expect(getByRole('gridcell', { name: 'extension' })).toBeInTheDocument();
|
||||||
expect(getByText('size')).toBeInTheDocument();
|
expect(getByRole('gridcell', { name: 'size' })).toBeInTheDocument();
|
||||||
expect(getByText('created')).toBeInTheDocument();
|
expect(getByText('created')).toBeInTheDocument();
|
||||||
expect(getByText('last update')).toBeInTheDocument();
|
expect(getByText('last update')).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|||||||
@ -136,6 +136,7 @@ export const MediaLibrary = () => {
|
|||||||
assetsData?.results?.map((asset) => ({ ...asset, type: 'asset', isSelectable: canUpdate })) ||
|
assetsData?.results?.map((asset) => ({ ...asset, type: 'asset', isSelectable: canUpdate })) ||
|
||||||
[];
|
[];
|
||||||
const assetCount = assets?.length ?? 0;
|
const assetCount = assets?.length ?? 0;
|
||||||
|
const totalAssetCount = assetsData?.pagination?.total;
|
||||||
|
|
||||||
const isLoading = isCurrentFolderLoading || foldersLoading || permissionsLoading || assetsLoading;
|
const isLoading = isCurrentFolderLoading || foldersLoading || permissionsLoading || assetsLoading;
|
||||||
const [showUploadAssetDialog, setShowUploadAssetDialog] = useState(false);
|
const [showUploadAssetDialog, setShowUploadAssetDialog] = useState(false);
|
||||||
@ -458,7 +459,7 @@ export const MediaLibrary = () => {
|
|||||||
id: getTrad('list.assets.title'),
|
id: getTrad('list.assets.title'),
|
||||||
defaultMessage: 'Assets ({count})',
|
defaultMessage: 'Assets ({count})',
|
||||||
},
|
},
|
||||||
{ count: assetCount }
|
{ count: totalAssetCount }
|
||||||
)) ||
|
)) ||
|
||||||
''
|
''
|
||||||
}
|
}
|
||||||
|
|||||||
@ -559,11 +559,11 @@ describe('Media library homepage', () => {
|
|||||||
it('should render the table headers', () => {
|
it('should render the table headers', () => {
|
||||||
usePersistentState.mockReturnValueOnce([viewOptions.LIST]);
|
usePersistentState.mockReturnValueOnce([viewOptions.LIST]);
|
||||||
|
|
||||||
const { getByText } = renderML();
|
const { getByText, getByRole } = renderML();
|
||||||
expect(getByText('preview')).toBeInTheDocument();
|
expect(getByRole('gridcell', { name: 'preview' })).toBeInTheDocument();
|
||||||
expect(getByText('name')).toBeInTheDocument();
|
expect(getByText('name')).toBeInTheDocument();
|
||||||
expect(getByText('extension')).toBeInTheDocument();
|
expect(getByRole('gridcell', { name: 'extension' })).toBeInTheDocument();
|
||||||
expect(getByText('size')).toBeInTheDocument();
|
expect(getByRole('gridcell', { name: 'size' })).toBeInTheDocument();
|
||||||
expect(getByText('created')).toBeInTheDocument();
|
expect(getByText('created')).toBeInTheDocument();
|
||||||
expect(getByText('last update')).toBeInTheDocument();
|
expect(getByText('last update')).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user