diff --git a/packages/dnb-eufemia/src/extensions/forms/Tools/Log.tsx b/packages/dnb-eufemia/src/extensions/forms/Tools/Log.tsx index eb3646b4483..271b29ed75c 100644 --- a/packages/dnb-eufemia/src/extensions/forms/Tools/Log.tsx +++ b/packages/dnb-eufemia/src/extensions/forms/Tools/Log.tsx @@ -54,13 +54,15 @@ function replaceUndefinedValues( ): unknown { if (typeof value === 'undefined') { return replaceWith + } else if (Array.isArray(value)) { + return value.map((item) => replaceUndefinedValues(item, replaceWith)) } else if (value && typeof value === 'object' && value !== replaceWith) { return { ...value, ...Object.fromEntries( Object.entries(value).map(([k, v]) => [ k, - replaceUndefinedValues(v), + replaceUndefinedValues(v, replaceWith), ]) ), } diff --git a/packages/dnb-eufemia/src/extensions/forms/Tools/__tests__/Log.test.tsx b/packages/dnb-eufemia/src/extensions/forms/Tools/__tests__/Log.test.tsx new file mode 100644 index 00000000000..a2cd83f9c5a --- /dev/null +++ b/packages/dnb-eufemia/src/extensions/forms/Tools/__tests__/Log.test.tsx @@ -0,0 +1,43 @@ +import React from 'react' +import { render } from '@testing-library/react' +import { Form, Tools } from '../../' + +describe('Tools.Log', () => { + it('should render data context', () => { + const data = { foo: 'bar' } + render( +