-
-
Save dvallin/ff9381be7e2db50eb73cc821fee5ad8e 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
import store from '../../src/store' | |
// ... | |
it('adds task from input field, if enter key is pressed', (done) => { | |
const spy = jest.spyOn(store, 'dispatch'); // 0 | |
const givenValue = "A very special value"; | |
const wrapper = mount(NewTaskInput, { store }); | |
const input = wrapper.find('input'); | |
input.element.value = givenValue; // 1 | |
input.trigger('input'); // 2 | |
input.trigger('keyup.enter'); // 3 | |
wrapper.vm.$nextTick(() => { // 4 | |
expect(spy).toHaveBeenCalledWith({ | |
type: Actions.AddTask, | |
title: givenValue | |
}); | |
done(); // 5 | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment