fix: unable to disallow csv upload on header menu (#30271)

This commit is contained in:
JUST.in DO IT 2024-09-17 14:27:47 -07:00 committed by GitHub
parent 2f0c9947ce
commit cd8b56706b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 6 deletions

View File

@ -308,10 +308,13 @@ test('If there is a DB with allow_file_upload set as True the option should be e
userEvent.hover(dropdown);
const dataMenu = await screen.findByText(dropdownItems[0].label);
userEvent.hover(dataMenu);
expect(await screen.findByText('Upload CSV to database')).toBeInTheDocument();
const csvMenu = await screen.findByText('Upload CSV to database');
expect(csvMenu).toBeInTheDocument();
expect(
await screen.findByText('Upload Excel to database'),
).toBeInTheDocument();
expect(csvMenu).not.toHaveAttribute('aria-disabled', 'true');
});
test('If there is NOT a DB with allow_file_upload set as True the option should be disabled', async () => {
@ -341,10 +344,11 @@ test('If there is NOT a DB with allow_file_upload set as True the option should
userEvent.hover(dropdown);
const dataMenu = await screen.findByText(dropdownItems[0].label);
userEvent.hover(dataMenu);
expect(await screen.findByText('Upload CSV to database')).toBeInTheDocument();
expect(
(await screen.findByText('Upload CSV to database')).closest('a'),
).not.toBeInTheDocument();
const csvMenu = await screen.findByRole('menuitem', {
name: 'Upload CSV to database',
});
expect(csvMenu).toBeInTheDocument();
expect(csvMenu).toHaveAttribute('aria-disabled', 'true');
});
test('Logs out and clears local storage item redux', async () => {

View File

@ -313,7 +313,7 @@ const RightMenu = ({
const buildMenuItem = (item: MenuObjectChildProps) =>
item.disable ? (
<Menu.Item key={item.name} css={styledDisabled}>
<Menu.Item key={item.name} css={styledDisabled} disabled>
<Tooltip placement="top" title={tooltipText}>
{item.label}
</Tooltip>