Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: make social container element a span #236

Merged
merged 3 commits into from
Nov 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()
})
})
Loading