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

Cannot add single todo - {enter} is not working #1

Open
bahmutov opened this issue Sep 14, 2017 · 9 comments
Open

Cannot add single todo - {enter} is not working #1

bahmutov opened this issue Sep 14, 2017 · 9 comments
Labels

Comments

@bahmutov
Copy link
Owner

Very weird bug (0.20.0) and latest dev version on Sept 14 2017.

The test code

const getItems = () =>
  cy.get('.todo-list li')

it('adds 1 todo', () => {
  const url = 'http://todomvc.com/examples/vanillajs/'
  cy.visit(url)
  getItems()
    .should('have.length', 0)
  cy.get('.new-todo').type('pass this test').type('{enter}')
  getItems()
    .should('have.length', 1)
})

The text is typed, but {enter} does not add new Todo item.

screen shot 2017-09-14 at 11 29 20 am

When manually trying to press "Enter" key in the input box, it is not working.

But then, if I press any other regular key, like space, and then press "Enter" it adds a new todo item

screen shot 2017-09-14 at 11 36 34 am

@bahmutov bahmutov added the bug label Sep 14, 2017
@brian-mann
Copy link

Is this not a bug with vanilla.js ???

@bahmutov
Copy link
Owner Author

why would it be a bug with vanilla.js? It works outside the test

@brian-mann
Copy link

When manually trying to press "Enter" key in the input box, it is not working.

But then, if I press any other regular key, like space, and then press "Enter" it adds a new todo item

@bahmutov
Copy link
Owner Author

^^ inside Cypress but not inside a browser

@brian-mann
Copy link

nonsense!

@bahmutov
Copy link
Owner Author

I know! yet something goes wrong

@bahmutov
Copy link
Owner Author

Hmm, does not fire "change" event on Enter for some reason
screen shot 2017-09-14 at 3 11 33 pm

@bahmutov
Copy link
Owner Author

Ha, it fires changed event if using .type("foo{enter}") and does not fire it when using .type("foo").type("{enter}")

@bahmutov
Copy link
Owner Author

Hmm, by itself in this example .type('{enter}') does not notice the change because inserting the EOL character "\n" seems to have no effect on jQuery value. Notice that while the same of strings has new line, the this._el.value remains unchanged with length 14

screen shot 2017-09-14 at 3 40 15 pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants