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

cy.type does not fire beforeInput event / does not work with slate.js #7088

Closed
nekolnyt opened this issue Apr 21, 2020 · 4 comments · Fixed by #8411
Closed

cy.type does not fire beforeInput event / does not work with slate.js #7088

nekolnyt opened this issue Apr 21, 2020 · 4 comments · Fixed by #8411
Labels
topic: cy.type ⌨️ type: unexpected behavior User expected result, but got another

Comments

@nekolnyt
Copy link

Current behavior:

cy.type command does not fire beforeInput event.

The documentation https://docs.cypress.io/api/commands/type.html#Events says:

beforeinput is not fired even though it is in the spec because no browser has adopted it.

This statement is not true anymore and not firing the event makes it impossible to use Cypress for testing editor implemented with Slate.js.

Desired behavior:

cy.type does fire beforeInput event.

Test code to reproduce

https://github.com/nekolnyt/cypress-test-tiny-type-in-slate/blob/master/cypress/integration/spec.js

Versions

Cypress 4.4.0
OS: macOS Catalina 10.15.1
Browser: Chrome 81

Related issues

ianstormtaylor/slate#3476
#311 (comment)

@cypress-bot cypress-bot bot added the stage: proposal 💡 No work has been done of this issue label Apr 21, 2020
@jennifer-shehane jennifer-shehane added topic: cy.type ⌨️ type: unexpected behavior User expected result, but got another labels Apr 21, 2020
@reydelo
Copy link

reydelo commented Apr 22, 2020

Hopefully the Cypress team will update their input commands to dispatch the beforeinput event, but until they do I’ve created a couple of simple custom commands which will trigger Slate’s input event listeners and make it respond ianstormtaylor/slate#3476 (comment)

@sainthkh
Copy link
Contributor

sainthkh commented Aug 24, 2020

After some research, beforeinput is not the only problem.

I learned that simple cy.get('[data-slate-editor="true"]').type('test') is impossible. Because Cypress forcefully inserts text to content editable div. We need a new option like noAutomaticContentEditableUpdate. But the problem is that the name is too long.

One more problem is the inputType field of InputEvent. We need to decide what is the good default value.

@cypress-bot cypress-bot bot added stage: work in progress and removed stage: proposal 💡 No work has been done of this issue labels Aug 26, 2020
@cypress-bot cypress-bot bot added stage: needs review The PR code is done & tested, needs review and removed stage: work in progress labels Oct 6, 2020
@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 Oct 21, 2020
@cypress-bot cypress-bot bot added stage: pending release and removed stage: ready for work The issue is reproducible and in scope labels Oct 21, 2020
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Oct 21, 2020

The code for this is done in cypress-io/cypress#8411, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Oct 27, 2020

Released in 5.5.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v5.5.0, please open a new issue.

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Oct 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
topic: cy.type ⌨️ type: unexpected behavior User expected result, but got another
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants