Skip to content

Commit

Permalink
feat(dashboard): Make FilterBar width resizable (#20778)
Browse files Browse the repository at this point in the history
* Add Resizable panel in DashboardBuilder to adjust the width for FiltersPanel
* store the adjusted width for individual dashboard in localStorage to memorize the state
* migrate DashboardBuilder test code by testing-library and jest
  • Loading branch information
justinpark authored Jul 20, 2022
1 parent 2c5201f commit 1debaca
Show file tree
Hide file tree
Showing 13 changed files with 536 additions and 223 deletions.
2 changes: 2 additions & 0 deletions superset-frontend/spec/helpers/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@
import 'jest-enzyme';
import './shim';
import { configure as configureTestingLibrary } from '@testing-library/react';
import { matchers } from '@emotion/jest';

configureTestingLibrary({
testIdAttribute: 'data-test',
});

document.body.innerHTML = '<div id="app" data-bootstrap="{}"></div>';
expect.extend(matchers);
24 changes: 17 additions & 7 deletions superset-frontend/spec/helpers/testing-library.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@ import { render, RenderOptions } from '@testing-library/react';
import { ThemeProvider, supersetTheme } from '@superset-ui/core';
import { BrowserRouter } from 'react-router-dom';
import { Provider } from 'react-redux';
import { combineReducers, createStore, applyMiddleware, compose } from 'redux';
import {
combineReducers,
createStore,
applyMiddleware,
compose,
Store,
} from 'redux';
import thunk from 'redux-thunk';
import { DndProvider } from 'react-dnd';
import { HTML5Backend } from 'react-dnd-html5-backend';
Expand All @@ -36,6 +42,7 @@ type Options = Omit<RenderOptions, 'queries'> & {
useRouter?: boolean;
initialState?: {};
reducers?: {};
store?: Store;
};

function createWrapper(options?: Options) {
Expand All @@ -46,6 +53,7 @@ function createWrapper(options?: Options) {
useRouter,
initialState,
reducers,
store,
} = options || {};

return ({ children }: { children?: ReactNode }) => {
Expand All @@ -58,13 +66,15 @@ function createWrapper(options?: Options) {
}

if (useRedux) {
const store = createStore(
combineReducers(reducers || reducerIndex),
initialState || {},
compose(applyMiddleware(thunk)),
);
const mockStore =
store ??
createStore(
combineReducers(reducers || reducerIndex),
initialState || {},
compose(applyMiddleware(thunk)),
);

result = <Provider store={store}>{result}</Provider>;
result = <Provider store={mockStore}>{result}</Provider>;
}

if (useQueryParams) {
Expand Down

This file was deleted.

Loading

0 comments on commit 1debaca

Please sign in to comment.