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 am trying to write tests to check the state changes of my component on mouse enter.
describe('animeButton',()=>{it('swaps between normal and hover views',()=>{constButton=mount(<AnimeButtonhoverTextClassName="hoverText"normalTextClassName="normalText"/>);// ReactTestUtils.Simulate.mouseEnter(Button); <-- Would also error outconstelement=Button.find('a');element.simulate('mouseEnter');<--Errorsout
When I run the little bit of code, I get an error 'NodeList is not defined' from Line 219 of /dist/anime.js. I was able to alter the source code to get passed this function if of unknownHTMLElement type, but then I hit a tags button elsewhere in the anime.js source code.
Ive tried many different approaches and cant find a way to simulate this mouseEnter.
What's the current recommended solution for testing components that use Anime components?
Since React Anime is a DOM based library, it might not work with test suites. There's some tricks to get around that that I'll try to implement though.
In the meantime for the test case at least, try not to use React Anime in it.
I had the same problem with animejs in a different context. I find it helpful to abstract my animation methods to a helper class and then stub them out.
In a before or beforeEach: sinon.stub(AnimationHelper.prototype, 'someAnimationMethod');
And in the corresponding after or afterEach: AnimationHelper.prototype.someAnimationMethod.restore();
And you can do all the sinon spying and faking you want.
(I'm not currently working with React though so I couldn't say how helpful this approach would be there)
Hey,
I am trying to write tests to check the state changes of my component on mouse enter.
When I run the little bit of code, I get an error 'NodeList is not defined' from Line 219 of /dist/anime.js. I was able to alter the source code to get passed this function if of unknownHTMLElement type, but then I hit a tags button elsewhere in the anime.js source code.
Ive tried many different approaches and cant find a way to simulate this mouseEnter.
What's the current recommended solution for testing components that use Anime components?
Full Error Log:
The text was updated successfully, but these errors were encountered: