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(ProcessEditor): e.appendChild is not a function #12613

Merged
merged 2 commits into from
Apr 4, 2024
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.
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 @@ -55,7 +55,7 @@ describe('ConfigContent', () => {
});
it('should render heading for selected task', () => {
renderConfigContent({
modelerRef: { current: '<div></div>' as unknown as Modeler },
modelerRef: { current: { get: () => {} } as unknown as Modeler },
bpmnDetails: { ...mockBpmnDetails, taskType: 'data' as BpmnTaskType },
});

Expand All @@ -68,7 +68,7 @@ describe('ConfigContent', () => {
it('should render helpText for selected task', async () => {
const user = userEvent.setup();
renderConfigContent({
modelerRef: { current: '<div></div>' as unknown as Modeler },
modelerRef: { current: { get: () => {} } as unknown as Modeler },
bpmnDetails: { ...mockBpmnDetails, taskType: 'data' as BpmnTaskType },
});

Expand All @@ -82,7 +82,7 @@ describe('ConfigContent', () => {

it('should render EditTaskId component', () => {
renderConfigContent({
modelerRef: { current: '<div></div>' as unknown as Modeler },
modelerRef: { current: { get: () => {} } as unknown as Modeler },
bpmnDetails: { ...mockBpmnDetails, taskType: 'data' as BpmnTaskType },
});

Expand All @@ -95,7 +95,7 @@ describe('ConfigContent', () => {
'should render correct header config for each taskType',
(taskType) => {
renderConfigContent({
modelerRef: { current: '<div></div>' as unknown as Modeler },
modelerRef: { current: { get: () => {} } as unknown as Modeler },
bpmnDetails: { ...mockBpmnDetails, taskType: taskType as BpmnTaskType },
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ import { useBpmnConfigPanelFormContext } from '../../../../contexts/BpmnConfigPa
jest.mock('../../../../contexts/BpmnContext', () => ({
useBpmnContext: () => ({
modelerRef: {
current: '<div></div>',
current: {
get: () => ({
updateProperties: jest.fn(),
}),
},
},
setBpmnDetails: jest.fn(),
bpmnDetails: {
Expand All @@ -20,16 +24,6 @@ jest.mock('../../../../contexts/BpmnContext', () => ({
}),
}));

jest.mock('../../../../hooks/useBpmnModeler', () => ({
useBpmnModeler: () => ({
getModeler: () => ({
get: () => ({
updateProperties: jest.fn(),
}),
}),
}),
}));

jest.mock('../../../../contexts/BpmnConfigPanelContext', () => ({
useBpmnConfigPanelFormContext: jest.fn(),
}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { KeyVerticalIcon } from '@studio/icons';
import { useBpmnContext } from '../../../../contexts/BpmnContext';

import { useBpmnConfigPanelFormContext } from '../../../../contexts/BpmnConfigPanelContext';
import { useBpmnModeler } from '../../../../hooks/useBpmnModeler';
import type Modeling from 'bpmn-js/lib/features/modeling/Modeling';

import classes from './EditTaskId.module.css';
Expand All @@ -16,10 +15,9 @@ export const EditTaskId = ({ ...rest }: EditTaskIdProps): React.ReactElement =>
const { t } = useTranslation();
const { bpmnDetails, modelerRef, setBpmnDetails } = useBpmnContext();
const { setMetaDataForm } = useBpmnConfigPanelFormContext();
const { getModeler } = useBpmnModeler();

const modeler = getModeler(modelerRef.current as unknown as HTMLDivElement);
const modeling: Modeling = modeler.get('modeling');
const modelerInstance = modelerRef.current;
const modeling: Modeling = modelerInstance.get('modeling');

const updateId = (value: string): void => {
modeling.updateProperties(bpmnDetails.element, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ describe('ConfigPanel', () => {

it('should render ConfigPanel if bpmn type is task', () => {
renderConfigPanel({
modelerRef: { current: '' as unknown as Modeler },
modelerRef: { current: { get: () => {} } as unknown as Modeler },
bpmnDetails: { ...mockBpmnDetails, type: BpmnTypeEnum.Task },
});
const editTaskIdButton = screen.getByRole('button', {
Expand Down
Loading