diff --git a/redisinsight/ui/src/pages/home/components/manual-connection/manual-connection-form/ManualConnectionFrom.spec.tsx b/redisinsight/ui/src/pages/home/components/manual-connection/manual-connection-form/ManualConnectionFrom.spec.tsx index 67620dc39e..e5e0e441c2 100644 --- a/redisinsight/ui/src/pages/home/components/manual-connection/manual-connection-form/ManualConnectionFrom.spec.tsx +++ b/redisinsight/ui/src/pages/home/components/manual-connection/manual-connection-form/ManualConnectionFrom.spec.tsx @@ -199,6 +199,39 @@ describe('InstanceForm', () => { ) }) + it('should change host input properly in edit mode', async () => { + const handleSubmit = jest.fn() + render( +
, + ) + + await act(async () => { + fireEvent.change(screen.getByTestId('host'), { + target: { value: 'redis.example.local' }, + }) + }) + + await act(async () => { + fireEvent.click(screen.getByTestId(BTN_SUBMIT)) + }) + + expect(handleSubmit).toHaveBeenCalledWith( + expect.objectContaining({ + host: 'redis.example.local', + }), + ) + }) + it('should change tls checkbox', async () => { const handleSubmit = jest.fn() const handleTestConnection = jest.fn() @@ -1334,9 +1367,7 @@ describe('InstanceForm', () => { />, ) - // Host is not shown in edit mode (shown as info above form) - expect(screen.queryByTestId('host')).not.toBeInTheDocument() - // Port, username, password should be disabled + expect(screen.getByTestId('host')).toBeDisabled() expect(screen.getByTestId('port')).toBeDisabled() expect(screen.getByTestId('username')).toBeDisabled() expect(screen.getByTestId('password')).toBeDisabled() @@ -1374,9 +1405,7 @@ describe('InstanceForm', () => { />, ) - // Host is not shown in edit mode (shown as info above form) - expect(screen.queryByTestId('host')).not.toBeInTheDocument() - // Port, username, password should NOT be disabled for non-Azure databases + expect(screen.getByTestId('host')).not.toBeDisabled() expect(screen.getByTestId('port')).not.toBeDisabled() expect(screen.getByTestId('username')).not.toBeDisabled() expect(screen.getByTestId('password')).not.toBeDisabled() diff --git a/redisinsight/ui/src/pages/home/components/manual-connection/manual-connection-form/forms/EditConnection.tsx b/redisinsight/ui/src/pages/home/components/manual-connection/manual-connection-form/forms/EditConnection.tsx index 889b4f2145..7540cfa332 100644 --- a/redisinsight/ui/src/pages/home/components/manual-connection/manual-connection-form/forms/EditConnection.tsx +++ b/redisinsight/ui/src/pages/home/components/manual-connection/manual-connection-form/forms/EditConnection.tsx @@ -60,7 +60,7 @@ const EditConnection = (props: Props) => { formik={formik} showFields={{ alias: true, - host: (!isEditMode || isCloneMode) && !isFromCloud, + host: !isFromCloud, port: !isFromCloud, timeout: true, }} diff --git a/redisinsight/ui/src/pages/home/components/manual-connection/manual-connection-form/forms/EditSentinelConnection.tsx b/redisinsight/ui/src/pages/home/components/manual-connection/manual-connection-form/forms/EditSentinelConnection.tsx index c3b0799fec..d3aebc1c60 100644 --- a/redisinsight/ui/src/pages/home/components/manual-connection/manual-connection-form/forms/EditSentinelConnection.tsx +++ b/redisinsight/ui/src/pages/home/components/manual-connection/manual-connection-form/forms/EditSentinelConnection.tsx @@ -102,7 +102,7 @@ const EditSentinelConnection = (props: Props) => {