Skip to content

2.1.5 breaks tests due to node.getAnimations #3468

@razzeee

Description

@razzeee

What package within Headless UI are you using?

@headlessui/react

What version of that package are you using?

2.1.5

What browser are you using?

This concernes a jest test, I'm not sure, if it also happens in a browser

Reproduction URL

A trimmed down menu plus a test seem to be enought to trigger this

                      <Menu>
                        <MenuButton>
                          <img alt="Avatar" />
                        </MenuButton>
                      </Menu>
    // User menu
    const button = screen.getByAltText('Avatar')
    await waitFor(async () => await userEvent.click(button))

Describe your issue

Tests fail with

    TypeError: node.getAnimations is not a function

      at waitForTransition (node_modules/@headlessui/react/dist/headlessui.dev.cjs:3752:26)
      at node_modules/@headlessui/react/dist/headlessui.dev.cjs:3739:13
      at invokeTheCallbackFunction (node_modules/jsdom/lib/jsdom/living/generated/Function.js:19:26)
      at runAnimationFrameCallbacks (node_modules/jsdom/lib/jsdom/browser/Window.js:603:13)
      at Timeout._onTimeout (node_modules/jsdom/lib/jsdom/browser/Window.js:581:11)

It seems to be happening, when we want to access a menu via it's menubutton

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions