Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'window:*' events #2886

Closed
chrisbreiding opened this issue Dec 3, 2018 · 1 comment
Closed

Add 'window:*' events #2886

chrisbreiding opened this issue Dec 3, 2018 · 1 comment
Assignees
Labels
pkg/driver This is due to an issue in the packages/driver directory stage: ready for work The issue is reproducible and in scope type: enhancement Requested enhancement of existing feature

Comments

@chrisbreiding
Copy link
Contributor

Add a new event 'namespace' window:* where * is any event you can register on the window. So a user can do the following:

cy.on('window:hashchange', (e) => {})

This would bind to the window's hashchange event and be unbound after the test finishes running. It would rebind if the page navigates. Any arbitrary window event can be bound and receives the event as normally binding with window.addEventListener.

// instead of
cy.window().then((win) => {
  const handler = () => {
    // handling code
    win.removeEventListener('foobar', handler)
  }
  win.addEventListener('foobar', handler, false)
})

// the user can do this
cy.on('window:foobar', (e) => {
  // handling code
})
@chrisbreiding chrisbreiding self-assigned this Dec 3, 2018
@chrisbreiding chrisbreiding added this to the Sprint 14 milestone Dec 3, 2018
@jennifer-shehane jennifer-shehane added the type: enhancement Requested enhancement of existing feature label Dec 4, 2018
@chrisbreiding chrisbreiding modified the milestones: Sprint 14, Sprint 15 Dec 10, 2018
@chrisbreiding chrisbreiding modified the milestones: Sprint 19, Sprint 20 Jan 22, 2019
@jennifer-shehane jennifer-shehane added the stage: ready for work The issue is reproducible and in scope label Jan 23, 2019
@chrisbreiding chrisbreiding modified the milestones: Sprint 20, Sprint 21 Jan 28, 2019
@cypress-bot cypress-bot bot added stage: work in progress and removed stage: ready for work The issue is reproducible and in scope labels Feb 19, 2019
@cypress-bot cypress-bot bot added stage: needs review The PR code is done & tested, needs review and removed stage: work in progress labels Mar 22, 2019
@jennifer-shehane jennifer-shehane added the pkg/driver This is due to an issue in the packages/driver directory label Jul 13, 2019
@jennifer-shehane jennifer-shehane removed this from the Sprint 21 milestone Jul 13, 2019
@cypress-bot cypress-bot bot added stage: ready for work The issue is reproducible and in scope and removed stage: needs review The PR code is done & tested, needs review labels Jun 18, 2020
@jennifer-shehane
Copy link
Member

Closing due to inactivity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg/driver This is due to an issue in the packages/driver directory stage: ready for work The issue is reproducible and in scope type: enhancement Requested enhancement of existing feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants