If this is a bug report, please provide as much info as possible
version: cypress 4.0.0, svelte 3.17.1
platform: win10
expected behavior: when svelte component adds event listener to document or window, the event is fired in a cypress-svelte-unit test
actual behavior: document and window events don't fire
Test.svelte:
<div>Doc click: {docClicks}</div>
<div>Win click: {winClicks}</div>
<script>
export let docClicks = 0
export let winClicks = 0
document.addEventListener('click', e => docClicks++)
window.addEventListener('click', e => winClicks++)
</script>
Cypress spec:
import Test from 'Test'
import mount from 'cypress-svelte-unit-test'
describe('Test', () => {
it('works', () => {
mount(Test).then(() => {
cy.viewport(600, 600)
cy.get('body').click() // also doesn't work to manually click from within the cypress test runner UI
// Cypress.component.$set({ docClicks: 1, winClicks: 1 }) // works, fwiw
cy.get('div').contains('Doc click: 1')
cy.get('div').contains('Win click: 1')
})
})
})
Is this a bug report or a feature request?
bug report
If this is a bug report, please provide as much info as possible
Test.svelte:
Cypress spec: