MCPcopy Create free account
hub / github.com/ReactTooltip/react-tooltip / AttributeChangeTest

Function AttributeChangeTest

src/test/tooltip-edge-cases.spec.js:202–220  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

200 test('tooltip handles attribute changes', async () => {
201 // Create a component where we'll change attributes
202 const AttributeChangeTest = () => {
203 const [tooltipId, setTooltipId] = useState('attribute-test')
204
205 useEffect(() => {
206 // Change the tooltip ID after a delay
207 const timer = setTimeout(() => {
208 setTooltipId('changed-id')
209 }, 100)
210 return () => clearTimeout(timer)
211 }, [])
212
213 return (
214 <div>
215 <span data-tooltip-id={tooltipId}>Hover Me</span>
216 <TooltipController id="attribute-test" content="Original ID" />
217 <TooltipController id="changed-id" content="Changed ID" />
218 </div>
219 )
220 }
221
222 // Render the component
223 render(<AttributeChangeTest />)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected