-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move layoutset stuff to accordion in config panel
- Loading branch information
Showing
13 changed files
with
132 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
.../libs/studio-components/src/components/StudioIconTextfield/StudioIconTextfield.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...packages/process-editor/src/components/ConfigPanel/ConfigContent/ConfigContent.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.accordion, | ||
.configContent { | ||
display: flex; | ||
flex-direction: column; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
...tor/src/components/ConfigPanel/ConfigContent/EditLayoutSetName/EditLayoutSetName.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import { render, screen } from '@testing-library/react'; | ||
import React from 'react'; | ||
import { EditLayoutSetName } from './EditLayoutSetName'; | ||
import { textMock } from '@studio/testing/mocks/i18nMock'; | ||
import { BpmnContext } from '../../../../contexts/BpmnContext'; | ||
import { | ||
mockBpmnApiContextValue, | ||
mockBpmnContextValue, | ||
} from '../../../../../test/mocks/bpmnContextMock'; | ||
import { BpmnApiContext, type BpmnApiContextProps } from '../../../../contexts/BpmnApiContext'; | ||
import userEvent from '@testing-library/user-event'; | ||
|
||
const existingLayoutSetNameMock = 'existingLayoutSetName'; | ||
|
||
describe('EditLayoutSetName', () => { | ||
it('should render the layoutSetName button', () => { | ||
renderEditLayoutSetName(); | ||
const editLayoutSetName = screen.getByRole('button', { | ||
name: textMock('process_editor.configuration_panel_layout_set_name_label'), | ||
}); | ||
expect(editLayoutSetName).toBeInTheDocument(); | ||
}); | ||
it('should render the name of the layoutSetName textfield using the connected taskId', () => { | ||
renderEditLayoutSetName(); | ||
const layoutSetNameViewMode = screen.getByLabelText( | ||
textMock('process_editor.configuration_panel_layout_set_name_label'), | ||
); | ||
expect(layoutSetNameViewMode).toHaveTextContent( | ||
textMock('process_editor.configuration_panel_layout_set_name', { | ||
taskId: mockBpmnContextValue.bpmnDetails.id, | ||
}) + existingLayoutSetNameMock, | ||
); | ||
}); | ||
it('should call mutateLayoutSet when changing name', async () => { | ||
const user = userEvent.setup(); | ||
const newLayoutSetName = 'newLayoutSetName'; | ||
const mutateLayoutSetIdMock = jest.fn(); | ||
renderEditLayoutSetName({ mutateLayoutSetId: mutateLayoutSetIdMock }); | ||
const editLayoutSetName = screen.getByRole('button', { | ||
name: textMock('process_editor.configuration_panel_layout_set_name_label'), | ||
}); | ||
await user.click(editLayoutSetName); | ||
const inputNewLayoutSetName = screen.getByRole('textbox', { | ||
name: textMock('process_editor.configuration_panel_layout_set_name_label'), | ||
}); | ||
await user.clear(inputNewLayoutSetName); | ||
await user.type(inputNewLayoutSetName, newLayoutSetName); | ||
await user.tab(); | ||
expect(mutateLayoutSetIdMock).toHaveBeenCalledTimes(1); | ||
expect(mutateLayoutSetIdMock).toHaveBeenCalledWith({ | ||
layoutSetIdToUpdate: existingLayoutSetNameMock, | ||
newLayoutSetId: newLayoutSetName, | ||
}); | ||
}); | ||
}); | ||
|
||
const renderEditLayoutSetName = ( | ||
bpmnApiContextValue: Partial<BpmnApiContextProps> = {}, | ||
existingLayoutSetName = existingLayoutSetNameMock, | ||
) => { | ||
render( | ||
<BpmnApiContext.Provider value={{ ...mockBpmnApiContextValue, ...bpmnApiContextValue }}> | ||
<BpmnContext.Provider value={{ ...mockBpmnContextValue }}> | ||
<EditLayoutSetName existingLayoutSetName={existingLayoutSetName} /> | ||
</BpmnContext.Provider> | ||
</BpmnApiContext.Provider>, | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 0 additions & 4 deletions
4
.../process-editor/src/components/ConfigPanel/ConfigContent/EditTaskId/EditTaskId.module.css
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
frontend/packages/shared/src/hooks/useValidateLayoutSetName.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { textMock } from '@studio/testing/mocks/i18nMock'; | ||
import { useValidateLayoutSetName } from 'app-shared/hooks/useValidateLayoutSetName'; | ||
|
||
describe('useValidateLayoutSetName', () => { | ||
it('should return invalid layoutSetName errorText when name is invalid', () => { | ||
const existingLayoutSetName = 'existingLayoutSetName'; | ||
const { validateLayoutSetName } = useValidateLayoutSetName(); | ||
const layoutSetNameValidation = validateLayoutSetName(existingLayoutSetName, { | ||
sets: [{ id: existingLayoutSetName, tasks: [] }], | ||
}); | ||
expect(layoutSetNameValidation).toBe( | ||
textMock('process_editor.configuration_panel_layout_set_id_not_unique'), | ||
); | ||
}); | ||
it('should return empty string when name is valid', () => { | ||
const uniqueLayoutSetName = 'uniqueLayoutSetName'; | ||
const { validateLayoutSetName } = useValidateLayoutSetName(); | ||
const layoutSetNameValidation = validateLayoutSetName(uniqueLayoutSetName, { | ||
sets: [{ id: 'existingLayoutSetName', tasks: [] }], | ||
}); | ||
expect(layoutSetNameValidation).toBe(''); | ||
}); | ||
}); |