Skip to content

Commit

Permalink
chore(Space): fix test error innerRef on DOM elem (#1931)
Browse files Browse the repository at this point in the history
  • Loading branch information
langz committed Feb 22, 2023
1 parent 3c0eba8 commit eb6372e
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions packages/dnb-eufemia/src/components/space/Space.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,28 +37,31 @@ function Element({
innerRef,
...props
}: SpaceAllProps) {
const E = element as DynamicElement<any>
const ElementDynamic = element as DynamicElement<any>
let component: React.ReactElement = null

if (E === Section) {
if (ElementDynamic === Section) {
component = (
<E {...props} innerRef={innerRef}>
<ElementDynamic {...props} inner_ref={innerRef}>
{children}
</E>
</ElementDynamic>
)
} else {
// also used for code markup simulation
validateDOMAttributes({}, props)

component = (
<E {...props} ref={innerRef}>
<ElementDynamic {...props} ref={innerRef}>
{children}
</E>
</ElementDynamic>
)
}

if (isTrue(no_collapse)) {
const R = E === 'span' || isInline(element as string) ? 'span' : 'div'
const R =
ElementDynamic === 'span' || isInline(element as string)
? 'span'
: 'div'
return (
<R
className={classnames(
Expand Down

0 comments on commit eb6372e

Please sign in to comment.