fix(dashboard-css): make to stay custom css when reload (#19084)

* fix(dashboard-css): make to stay custome css when reload

* fix(dashboard-css): make to add injectCustomCSS into HeaderActionsDropdown.test.tsx
This commit is contained in:
smileydev 2022-03-16 01:10:55 -04:00 committed by GitHub
parent 8e7af79aa9
commit 30c97ad5bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -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 = () => ({
@ -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');
});

View File

@ -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 => ({