mirror of
https://github.com/apache/superset.git
synced 2024-09-06 13:57:40 -04:00
chore: Adds QueryParamProvider to testing helper (#14195)
This commit is contained in:
parent
fa0915d9e6
commit
fa510df624
@ -26,16 +26,19 @@ import thunk from 'redux-thunk';
|
|||||||
import { DndProvider } from 'react-dnd';
|
import { DndProvider } from 'react-dnd';
|
||||||
import { HTML5Backend } from 'react-dnd-html5-backend';
|
import { HTML5Backend } from 'react-dnd-html5-backend';
|
||||||
import reducerIndex from 'spec/helpers/reducerIndex';
|
import reducerIndex from 'spec/helpers/reducerIndex';
|
||||||
|
import { QueryParamProvider } from 'use-query-params';
|
||||||
|
|
||||||
type Options = Omit<RenderOptions, 'queries'> & {
|
type Options = Omit<RenderOptions, 'queries'> & {
|
||||||
useRedux?: boolean;
|
useRedux?: boolean;
|
||||||
useDnd?: boolean;
|
useDnd?: boolean;
|
||||||
|
useQueryParams?: boolean;
|
||||||
initialState?: {};
|
initialState?: {};
|
||||||
reducers?: {};
|
reducers?: {};
|
||||||
};
|
};
|
||||||
|
|
||||||
function createWrapper(options?: Options) {
|
function createWrapper(options?: Options) {
|
||||||
const { useDnd, useRedux, initialState, reducers } = options || {};
|
const { useDnd, useRedux, useQueryParams, initialState, reducers } =
|
||||||
|
options || {};
|
||||||
|
|
||||||
return ({ children }: { children?: ReactNode }) => {
|
return ({ children }: { children?: ReactNode }) => {
|
||||||
let result = (
|
let result = (
|
||||||
@ -56,6 +59,10 @@ function createWrapper(options?: Options) {
|
|||||||
result = <Provider store={store}>{result}</Provider>;
|
result = <Provider store={store}>{result}</Provider>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (useQueryParams) {
|
||||||
|
result = <QueryParamProvider>{result}</QueryParamProvider>;
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user