Search the Community
Showing results for tags 'tests'.
-
Hi all, Not sure if i'm missing something or if I'm doing something incorrect. But I'm trying to run simple unit tests with Jest and Enzyme on my component that uses gsap for a search input box. The component works perfectly fine, animation is great too. But whenever i run my tests, and specifically this line component.find('#close').'click' i get ERROR CANNOT TWEEN A NULL TARGET the close button calls this function below: animation.hideSearch(this.searchInput) animation.hideSearch is: hideSearch(target){ return TweenMax .to(target, duration, { opacity: 0, display: 'none' }) }, And finally here is my search input: <input id='search-input' className={styles.input} value={this.state.searchValue} onChange={this.handleSearch} ref={div => this.searchInput = div}/> Is there anything i need to configure in order to get jest to ignore the gsap animation? Any help is appreciated. thanks!
-
We're currently using TweenMax and TimelineMax extensively in our app, and we're also running a suite of unit tests against the interface via mocha and we've discovered that one of the major factors pushing our automated test times up is that GSAP appears to still be doing a lot of work, even when we monkeyPatch the tween/timeline durations down to 0. I haven't cracked open the GSAP lib to explore the inner workings yet, but my first thought was to just patch to(), from(), and fromTo() with nearly empty functions that will handle the callbacks. Although I still need to move the animated elements to their ending position, so maybe I could clone the .set() method and extend it to execute callbacks? But I have no idea if that's opening up a can of worms... So I was curious if this is something the GSAP team has already addressed in the past... maybe you guys already built out a solution or have some branch somewhere that handles all the potential animation types and all the various callbacks for both tweens and timelines, but has been optimized for an automated testing environment?