Skip to content
This repository was archived by the owner on Nov 9, 2024. It is now read-only.
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 @@ -46,7 +46,7 @@
},
"dependencies": {
"prop-types": "^15.6.2",
"tippy.js": "^4.2.1"
"tippy.js": "^4.3.0"
},
"peerDependencies": {
"react": ">=16.8",
Expand Down
5 changes: 1 addition & 4 deletions src/TippyGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ export default function TippyGroup({ children, ...props }) {

useEffect(() => {
tippy.group(instancesRef.current, props)
return () => {
instancesRef.current = null
}
}, [])
})

return Children.map(children, child => {
return cloneElement(child, {
Expand Down
28 changes: 28 additions & 0 deletions test/TippyGroup.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,32 @@ describe('<TippyGroup />', () => {

render(<App />)
})

test('props are updateable', () => {
const delay = 1000
const nextDelay = 500
const { container, rerender } = render(
<TippyGroup delay={delay}>
<Tippy content="toolip">
<button />
</Tippy>
<Tippy content="toolip">
<button />
</Tippy>
</TippyGroup>,
)
const instance = container.querySelector('button')._tippy
expect(instance.props.delay).toBe(delay)
rerender(
<TippyGroup delay={nextDelay}>
<Tippy content="tooltip">
<button />
</Tippy>
<Tippy content="toolip">
<button />
</Tippy>
</TippyGroup>,
)
expect(instance.props.delay).toBe(nextDelay)
})
})