I'm using jsdom with enzyme+mocha+chai to test the behavior of a React component. The component has a method to focus a DOM node (using the usual node.focus()
) and I want to test the node is actually focused when it's called.
To know which node is focused, I compare document.activeElement
to the node I expect to be focused.
However, after upgrading to jsdom 9.1+, document.activeElement
seems always be HTMLBodyElement
, even after calling the node's focus()
method.
With jsdom 9.0 the tests run fine.
I read jsdom 9.1+ contains some changes related to the focus event, yet I couldn't understand how make document.activeElement
behave as expected. Any help?
Aucun commentaire:
Enregistrer un commentaire