Skip to content

Commit

Permalink
Merge pull request #236 from dejorrit/main
Browse files Browse the repository at this point in the history
fix: make social container element a span
  • Loading branch information
couetilc authored Nov 26, 2023
2 parents 1d46eb0 + fc66d4c commit 51a796d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,4 +140,4 @@
"react-dom": "^18.2.0"
},
"packageManager": "[email protected]"
}
}
4 changes: 2 additions & 2 deletions src/component.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export const SocialIcon = React.forwardRef(function SocialIcon(props, ref) {
'aria-label': ariaLabel,
ref,
},
<div className="social-container" style={social_container}>
<span className="social-container" style={social_container}>
<svg
role="img"
aria-label={`${ariaLabel} social icon`}
Expand Down Expand Up @@ -141,7 +141,7 @@ export const SocialIcon = React.forwardRef(function SocialIcon(props, ref) {
<path d={path} />
</g>
</svg>
</div>,
</span>,
children,
)
})
6 changes: 6 additions & 0 deletions test/unit/cases.js
Original file line number Diff line number Diff line change
Expand Up @@ -313,4 +313,10 @@ export const cases = ({ SocialIcon, getKeys }) =>
)
})
}

// from https://github.com/couetilc/react-social-icons/pull/236
it('renders the svg within an inline element', ({ expect }) => {
render(<SocialIcon url={pinterest_url} />)
expect(link().querySelector('div')).toBeNull()
})
})

0 comments on commit 51a796d

Please sign in to comment.