Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,46 @@ describe('EditSpaceSettings', () => {
expect(navigateSpy).toHaveBeenCalledTimes(1);
});

it('navigates away when cancel is clicked after changing the solution view', async () => {
const spaceToUpdate = {
id: 'existing-space',
name: 'Existing Space',
description: 'hey an existing space',
color: '#aabbcc',
initials: 'AB',
disabledFeatures: [],
solution: undefined,
};

render(
<TestComponent>
<EditSpaceSettingsTab
space={spaceToUpdate}
history={history}
features={[]}
allowFeatureVisibility={false}
allowSolutionVisibility={true}
reloadWindow={reloadWindow}
/>
</TestComponent>
);

// update the space solution view
const solutionViewPicker = screen.getByTestId('solutionViewSelect');
await userEvent.click(solutionViewPicker);

const esSolutionOption = await screen.findByTestId('solutionViewEsOption');
await userEvent.click(esSolutionOption);

expect(screen.getByTestId('space-edit-page-user-impact-warning')).toBeInTheDocument();

// click cancel - should navigate back to spaces list without saving
const cancelButton = screen.getByTestId('cancel-space-button');
await userEvent.click(cancelButton);

expect(navigateSpy).toHaveBeenCalledWith('/');
});

it('warns when updating features in the active space', async () => {
const features = [
new KibanaFeature({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ export const EditSpaceSettingsTab: React.FC<Props> = ({ space, features, history
const onClickCancel = useCallback(() => {
setShowAlteringActiveSpaceDialog(false);
setShowUserImpactWarning(false);
setIsDirty(false);
backToSpacesList();
}, [backToSpacesList]);

Expand Down
Loading