Skip to content

Commit

Permalink
fix(dashboard-css): make to stay custom css when reload (#19084)
Browse files Browse the repository at this point in the history
* fix(dashboard-css): make to stay custome css when reload

* fix(dashboard-css): make to add injectCustomCSS into HeaderActionsDropdown.test.tsx
  • Loading branch information
prosdev0107 committed Mar 16, 2022
1 parent 8e7af79 commit 30c97ad
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { render, screen } from 'spec/helpers/testing-library';
import userEvent from '@testing-library/user-event';
import fetchMock from 'fetch-mock';
import { HeaderDropdownProps } from 'src/dashboard/components/Header/types';
import injectCustomCss from 'src/dashboard/util/injectCustomCss';
import HeaderActionsDropdown from '.';

const createProps = () => ({
Expand Down Expand Up @@ -180,7 +181,9 @@ test('should NOT render the "Refresh dashboard" menu item as disabled', async ()

test('should render with custom css', () => {
const mockedProps = createProps();
const { customCss } = mockedProps;
render(setup(mockedProps));
injectCustomCss(customCss);
expect(screen.getByRole('button')).toHaveStyle('margin-left: 100px');
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,6 @@ class HeaderActionsDropdown extends React.PureComponent {
}

UNSAFE_componentWillMount() {
injectCustomCss(this.state.css);

SupersetClient.get({ endpoint: '/csstemplateasyncmodelview/api/read' })
.then(({ json }) => {
const cssTemplates = json.result.map(row => ({
Expand Down

0 comments on commit 30c97ad

Please sign in to comment.