mirror of
https://github.com/apache/superset.git
synced 2026-04-26 11:34:27 +00:00
fix: enable admin to edit dataset in explore (#20613)
* add conditional * add test * fix lint
This commit is contained in:
committed by
GitHub
parent
0ce0c6e1eb
commit
e1a918f141
@@ -139,6 +139,27 @@ test('Click on Edit dataset', async () => {
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('Edit dataset should be disabled when user is not admin', async () => {
|
||||
const props = createProps();
|
||||
// @ts-expect-error
|
||||
props.user.roles = {};
|
||||
props.datasource.owners = [];
|
||||
SupersetClientGet.mockImplementation(
|
||||
async () => ({ json: { result: [] } } as any),
|
||||
);
|
||||
|
||||
render(<DatasourceControl {...props} />, {
|
||||
useRedux: true,
|
||||
});
|
||||
|
||||
userEvent.click(screen.getByTestId('datasource-menu-trigger'));
|
||||
|
||||
expect(screen.getByTestId('edit-dataset')).toHaveAttribute(
|
||||
'aria-disabled',
|
||||
'true',
|
||||
);
|
||||
});
|
||||
|
||||
test('Click on View in SQL Lab', async () => {
|
||||
const props = createProps();
|
||||
const postFormSpy = jest.spyOn(SupersetClient, 'postForm');
|
||||
|
||||
Reference in New Issue
Block a user