You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to write some simple vitest tests for nodeOps. Here's an example:
it('should not throw on nodeOps.remove',async()=>{constmesh=nodeOps.createElement('TresMesh')constparent=nodeOps.createElement('TresMesh')nodeOps.insert(mesh,parent)nodeOps.remove(mesh)})
This test fails with the following error:
TypeError: deregisterBlockingObjectAtPointerEventHandler is not a function
Desired outcome
Insertions/removals without a root shouldn't throw.
constctx=node.__tres// remove is only called on the node being removed and not on child nodes.node.parent=node.parent||sceneconst{
deregisterObjectAtPointerEventHandler,
deregisterBlockingObjectAtPointerEventHandler,}=ctx.root
Proposed solution
Dispatch an event and handle at the root. That would allow the tests to pass and reduce some coupling at the same time.
Hi @andretchen0 I think @garrlker PR #529 will remove the need to use those methods. But, for tests we will need to mock the root state since its widely used
Describe the bug
Description
I'm trying to write some simple vitest tests for nodeOps. Here's an example:
This test fails with the following error:
TypeError: deregisterBlockingObjectAtPointerEventHandler is not a function
Desired outcome
Insertions/removals without a root shouldn't throw.
Steps to reproduce
pnpm run test:ui
Context
Related: #515
The code that throws starts at line 137:
Proposed solution
Dispatch an event and handle at the root. That would allow the tests to pass and reduce some coupling at the same time.
For what it's worth, this is how
THREE.Material.dispose()
works, which is called in the Tres code right below the block shown above.Used Package Manager
pnpm
Code of Conduct
The text was updated successfully, but these errors were encountered: