Created
June 2, 2018 04:22
-
-
Save qswitcher/adbe5d831207f2efa3cd20f220a83196 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test('entering a todo in form adds a todo', async () => { | |
// enter todo text in textbox | |
wrapper.find('.TodoForm-input').instance().value = 'My new todo'; | |
// click Add | |
wrapper.find('.TodoForm-button').simulate('click'); | |
// wait for Todo to show up | |
await wait(wrapper, w => | |
w | |
.find('.TodoItem') | |
.at(3) | |
.exists() | |
); | |
// make sure form is cleared | |
expect(wrapper.find('.TodoForm-input').instance().value).toEqual(''); | |
// make sure todo was added | |
const newText = wrapper | |
.find('.TodoItem') | |
.at(3) | |
.find('.TodoItem-text') | |
.text(); | |
expect(newText).toEqual('My new todo'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment