Skip to content

Vue: emitted custom event not triggering spy #25198

Discussion options

You must be logged in to vote

For anyone else in the same situation, I've managed to solve this by rewriting the assertion as such:

cy.contains( 'Remove Field' )
  .first()
  .click()
  .then( () => {
    cy.wrap( Cypress.vueWrapper.emitted( 'deleteField') ).should( 'have.length' , 1 )
   } )

Source: https://stackoverflow.com/a/70213943/7041984

However, I'm still curious as to why this approach works where my original one did not, and where it's documented.

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@jon-karlsen
Comment options

@lmiller1990
Comment options

@jon-karlsen
Comment options

@lmiller1990
Comment options

@jon-karlsen
Comment options

Answer selected by jon-karlsen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants