Skip to content

Instantly share code, notes, and snippets.

@kenmori
Last active August 20, 2019 08:16
Show Gist options
  • Save kenmori/5b3c31ef8b54e37ee6012fded85d6c56 to your computer and use it in GitHub Desktop.
Save kenmori/5b3c31ef8b54e37ee6012fded85d6c56 to your computer and use it in GitHub Desktop.
jest x material-ui button or tooltips 'addEventListener' of undefined

when test with jest,[material-ui button or tooltips 'addEventListener' of undefined

Error: Uncaught [TypeError: Cannot read property 'addEventListener' of undefined]

console.error node_modules/react-test-renderer/cjs/react-test-renderer.development.js:9215
The above error occurred in the <Connect(OpenDialogIconButton)> component:
in Connect(OpenDialogIconButton) (at ManageApp/index.tsx:373)
in Tooltip (created by WithStyles(Tooltip))
in WithStyles(Tooltip) (at ManageApp/index.tsx:372)
in div (at ManageApp/index.tsx:368)
in td (created by ForwardRef(TableCell))

nested button is ...

 <Tooltip title="delete" area-label="Delete">
  <OpenDialogIconButton dialogId={confirmDialogId}>
    <Delete />
  </OpenDialogIconButton>
</Tooltip>

To fix temporary... but I have to some other aproch.

<OpenDialogIconButton dialogId={confirmDialogId}>
  <Delete />
</OpenDialogIconButton>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment