Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from
Mar 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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