I'm writing an integration tests and am trying to simulate backspacing
keyEvent. What I expect is:
- fill out the input
- clear the input using the backspace event it will append my client-side validation.
This is what i have at the moment:
`import { module, test } from 'qunit'`
`import { UniverseAcceptance } from '../helpers/acceptance-setup'`
`import { guestUser, signedInUser } from '../helpers/base-route-map'`
module 'Integration | Listing Create - Not Signed In ', UniverseAcceptance ->
guestUser @
@get 'categories', (request) =>
@json 200, data: @mocks.categories()
test 'when visiting /create', (assert) ->
visit '/create'
andThen ->
assert.equal currentPath(), 'create'
test 'firing validation message', (assert) ->
visit '/create'
click('.title-input').then ->
fillIn('.listing-title', 't').then ->
elem = $('.listing-title').focus()
keyEvent('.listing-title', 'keydown', 8).then ->
console.log find('.listing-title').val()
#^^ The val should be empty but it is not..
andThen ->
element = find('.title-input .field-errors small').text()
assert.equal(element, "can't be blank")
Note that I try to focus on the input first and then execute the keyEvent. Am I missing something basic?
Aucun commentaire:
Enregistrer un commentaire