I created a simple function to handle mouse wheel events in the menu component that I built. The component works fine, I'm trying to write a unit test around it, and this causes me a problem.
component handler:
handleWheel: function (event) { (event.deltaY < 0 ) ? this.moveUp() : this.moveDown(); return false; }
this.moveUp () / this.moveDown () just sets the state to firstIndex
The problem is that when I try to write a test for this function, I cannot get it to work. I am almost 100% sure that it is associated with the eventDetails object that I am transitioning to, but I do not know how to format it correctly.
// set firstIndex = 0 TestUtils.Simulate.scroll(menu, {deltaY: 52}); expect(menu.state.firstIndex).to.equal(1); // error: expected 0 to be 1
Does anyone know how to format TestUtils.Simulate.Scroll () correctly / know the best way to test onWheel ()?
source share