Add test to creating a new note
This commit is contained in:
parent
894ea3064d
commit
0e22183c73
1 changed files with 23 additions and 0 deletions
|
@ -48,4 +48,27 @@ describe('Reports', () => {
|
||||||
button.trigger('click')
|
button.trigger('click')
|
||||||
expect(note.isVisible()).toBe(false)
|
expect(note.isVisible()).toBe(false)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('creates a note', () => {
|
||||||
|
const wrapper = mount(Reports, {
|
||||||
|
store,
|
||||||
|
localVue
|
||||||
|
})
|
||||||
|
const noteTextArea = wrapper.find('textarea')
|
||||||
|
const notes = store.state.reports.fetchedReports[0].notes
|
||||||
|
|
||||||
|
expect(noteTextArea.isVisible()).toBe(false)
|
||||||
|
|
||||||
|
wrapper.find('.el-button--default').trigger('click')
|
||||||
|
expect(noteTextArea.isVisible()).toBe(true)
|
||||||
|
expect(notes.length).toBe(2)
|
||||||
|
|
||||||
|
noteTextArea.setValue('new note')
|
||||||
|
wrapper.find('.submit-button').trigger('click')
|
||||||
|
const updatedNotes = store.state.reports.fetchedReports[0].notes
|
||||||
|
expect(updatedNotes.length).toBe(3)
|
||||||
|
|
||||||
|
wrapper.find('.new-note .el-icon-close').trigger('click')
|
||||||
|
expect(noteTextArea.isVisible()).toBe(false)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue