Skip to content

Commit

Permalink
added one more test to EditComponentId
Browse files Browse the repository at this point in the history
  • Loading branch information
JamalAlabdullah committed Jan 31, 2024
1 parent 4c8d637 commit 0f9605f
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,18 @@ describe('EditComponentId', () => {
await act(() => user.click(document.body));
expect(textField).not.toBeInTheDocument();
});

it('when user in edit mode and changes the textfield value, fieldProps.onChange should be called', async () => {
const user = userEvent.setup();
const handleComponentUpdate = jest.fn();
await studioRender({ handleComponentUpdate });
const testIdButton = screen.getByRole('button', { name: 'ID: test' });
await act(() => user.click(testIdButton));
const textField = screen.getByRole('textbox', {
name: textMock('ux_editor.modal_properties_component_change_id'),
});
await act(() => user.type(textField, 'newTestId'));
await act(() => user.click(document.body));
expect(handleComponentUpdate).toHaveBeenCalled();
});
});

0 comments on commit 0f9605f

Please sign in to comment.