Complete the code to trigger a custom event named 'myEvent' on the element with id 'button'.
cy.get('#button').[1]('myEvent')
The trigger command is used to fire custom events on elements in Cypress.
Complete the code to trigger a custom event 'myEvent' with additional data { key: 'value' } on the element with class 'item'.
cy.get('.item').trigger('myEvent', [1])
When triggering events with extra data, pass an object as the second argument.
Fix the error in the code to correctly trigger a custom event 'customEvent' with bubbling enabled on the element with id 'box'.
cy.get('#box').trigger('customEvent', { [1]: true })
The correct property to enable event bubbling is bubbles set to true.
Fill both blanks to trigger a custom event 'update' with bubbling and cancelable options set to true on the element with class 'card'.
cy.get('.card').trigger('update', { [1]: true, [2]: true })
To enable event bubbling and allow the event to be cancelable, use bubbles and cancelable set to true.
Fill all three blanks to trigger a custom event 'refresh' with bubbling and cancelable set to true, and pass detail data { id: 123 } on the element with id 'container'.
cy.get('#container').trigger('refresh', { [1]: true, [2]: true, [3]: { id: 123 } })
The detail property is used to pass custom data with the event. bubbles and cancelable enable event propagation and cancellation.