Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions superset-frontend/src/features/home/RightMenu.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down Expand Up @@ -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 () => {
Expand Down
2 changes: 1 addition & 1 deletion superset-frontend/src/features/home/RightMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Loading