While .trigger('mouseover'); triggers onMouseEnter event but .trigger('mouseleave'); doesn't trigger onMouseLeave event (React app)
.trigger('mouseleave'); should trigger onMouseLeave event
Checkout this stackblitz: https://stackblitz.com/edit/react-dmfnux?file=index.js
"Enter" and "leave" events both work well
Try this test
context('Hovering', () => {
it('should load properly', () => {
cy.visit('https://react-dmfnux.stackblitz.io');
cy.get('#target', { timeout: 60000 }).should('be.visible');
});
it('should trigger mouseleave event', () => {
cy.get('#target').trigger('mouseover');
cy.get('#text').should('contain', 'enter');
cy.get('#target').trigger('mouseleave');
cy.get('#text').should('contain', 'leave');
});
});
and see it fail

Chrome 72, Mac OS Mojave, Cypress 3.1.5
Your app is listening for mouseout as shown here:

React does this under the hood, when you set onMouseEnter/onMouseLeave, it listens on mouseover/mouseout.
Thanks @Bkucera !
Thank you @Bkucera :)
Most helpful comment
Your app is listening for
mouseoutas shown here:React does this under the hood, when you set
onMouseEnter/onMouseLeave, it listens onmouseover/mouseout.