feat(explore): Redesign of Run/Save buttons (#19558)

* feat(explore): Move save button to header, run button to bottom of control panel

* Make the tabs sticky

* Add error icon to Data tab

* Show message when creating chart and all controls are filled correctly

* Add tests and storybook

* Fix tests

* Disable save button when control have errors

* Fix types

* Apply code review comments

* Replace styled with css

* Remove unused import
This commit is contained in:
Kamil Gabryjelski
2022-04-13 16:58:39 +02:00
committed by GitHub
parent 32239b04aa
commit c8304a2821
13 changed files with 362 additions and 279 deletions

View File

@@ -90,6 +90,7 @@ const createProps = () => ({
user: {
userId: 1,
},
onSaveChart: jest.fn(),
});
test('Cancelling changes to the properties should reset previous properties', () => {
@@ -115,3 +116,17 @@ test('Cancelling changes to the properties should reset previous properties', ()
expect(screen.getByDisplayValue(prevChartName)).toBeInTheDocument();
});
test('Save chart', () => {
const props = createProps();
render(<ExploreHeader {...props} />, { useRedux: true });
userEvent.click(screen.getByText('Save'));
expect(props.onSaveChart).toHaveBeenCalled();
});
test('Save disabled', () => {
const props = createProps();
render(<ExploreHeader {...props} saveDisabled />, { useRedux: true });
userEvent.click(screen.getByText('Save'));
expect(props.onSaveChart).not.toHaveBeenCalled();
});