mirror of
https://github.com/apache/superset.git
synced 2026-04-18 23:55:00 +00:00
refactor: Sync Scoping tree with Forms data (#12171)
* refactor: sync Scoping tree with Forms data * refactor: update scoping tree * refactor: update scope tree logic to be more UX friendly * test: fix tests * lint: fix lin CR notes * fix: fix jsx * refactor: revert type changes * refactor: revert type changes * lint: fix lint * lint: fix lint * test: fix test * fix: process initial dashboard case * lint: fix lint / tests
This commit is contained in:
@@ -21,20 +21,40 @@ import { Provider } from 'react-redux';
|
||||
import ScopingTree from 'src/dashboard/components/nativeFilters/ScopingTree';
|
||||
import { styledMount as mount } from 'spec/helpers/theming';
|
||||
import { mockStore } from 'spec/fixtures/mockStore';
|
||||
import { FormInstance } from 'src/common/components';
|
||||
import { NativeFiltersForm } from 'src/dashboard/components/nativeFilters/types';
|
||||
import { getDefaultScopeValue } from 'src/dashboard/components/nativeFilters/FilterScope';
|
||||
|
||||
describe('ScopingTree', () => {
|
||||
const mock = jest.fn();
|
||||
const filterId = '1';
|
||||
const form = {
|
||||
getFieldValue: () => ({
|
||||
[filterId]: {
|
||||
scope: getDefaultScopeValue(),
|
||||
},
|
||||
}),
|
||||
};
|
||||
const wrapper = mount(
|
||||
<Provider store={mockStore}>
|
||||
<ScopingTree setFilterScope={mock} />
|
||||
<ScopingTree
|
||||
filterId={filterId}
|
||||
initialScope={getDefaultScopeValue()}
|
||||
form={(form as unknown) as FormInstance<NativeFiltersForm>}
|
||||
/>
|
||||
</Provider>,
|
||||
);
|
||||
it('is valid', () => {
|
||||
const mock = () => null;
|
||||
expect(React.isValidElement(<ScopingTree setFilterScope={mock} />)).toBe(
|
||||
true,
|
||||
);
|
||||
expect(
|
||||
React.isValidElement(
|
||||
<ScopingTree
|
||||
filterId={filterId}
|
||||
initialScope={getDefaultScopeValue()}
|
||||
form={(form as unknown) as FormInstance<NativeFiltersForm>}
|
||||
/>,
|
||||
),
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it('renders a tree', () => {
|
||||
expect(wrapper.find('TreeNode')).toExist();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user