diff --git a/frontend/src/component/admin/roles/RoleForm/useRoleForm.test.ts b/frontend/src/component/admin/roles/RoleForm/useRoleForm.test.ts index c9e8b431c0b1..d25da27c6b1d 100644 --- a/frontend/src/component/admin/roles/RoleForm/useRoleForm.test.ts +++ b/frontend/src/component/admin/roles/RoleForm/useRoleForm.test.ts @@ -14,14 +14,14 @@ describe('trim names and description', () => { expect(result.current.name).toBe('my role'); }); - test('description is trimmed before being set', () => { + test('description is not trimmed before being set', () => { const { result } = renderHook(() => useRoleForm()); act(() => { result.current.setDescription(' my description '); }); - expect(result.current.description).toBe('my description'); + expect(result.current.description).toBe(' my description '); }); test('name that is just whitespace triggers an error', () => { diff --git a/frontend/src/component/admin/roles/RoleForm/useRoleForm.ts b/frontend/src/component/admin/roles/RoleForm/useRoleForm.ts index f16f3e11dce9..fc077fe76e8b 100644 --- a/frontend/src/component/admin/roles/RoleForm/useRoleForm.ts +++ b/frontend/src/component/admin/roles/RoleForm/useRoleForm.ts @@ -29,8 +29,6 @@ export const useRoleForm = ( const [name, setName] = useState(initialName); const setTrimmedName = (newName: string) => setName(newName.trim()); const [description, setDescription] = useState(initialDescription); - const setTrimmedDescription = (newDescription: string) => - setDescription(newDescription.trim()); const [checkedPermissions, setCheckedPermissions] = useState({}); const [errors, setErrors] = useState(DEFAULT_ERRORS); @@ -147,7 +145,7 @@ export const useRoleForm = ( setName: setTrimmedName, validateName, description, - setDescription: setTrimmedDescription, + setDescription, validateDescription, checkedPermissions, setCheckedPermissions,