diff options
| author | Filipa Lacerda <filipa@gitlab.com> | 2017-08-08 14:54:43 +0100 |
|---|---|---|
| committer | Filipa Lacerda <filipa@gitlab.com> | 2017-08-08 14:54:58 +0100 |
| commit | 15441f0ef564e87f2ffb672452b0fb9d7bd1d44e (patch) | |
| tree | 614ab3c6053cf69db16055b43e2748da791661d2 /spec/javascripts/notes | |
| parent | b1a2b43fbb324d471f1f906ffc17a091c72c54cc (diff) | |
| download | gitlab-ce-15441f0ef564e87f2ffb672452b0fb9d7bd1d44e.tar.gz | |
[ci skip] Init testing vue app for issue notes
Diffstat (limited to 'spec/javascripts/notes')
| -rw-r--r-- | spec/javascripts/notes/components/issue_note_app_spec.js | 61 |
1 files changed, 44 insertions, 17 deletions
diff --git a/spec/javascripts/notes/components/issue_note_app_spec.js b/spec/javascripts/notes/components/issue_note_app_spec.js index 847cb2a23ff..9b48d3817a6 100644 --- a/spec/javascripts/notes/components/issue_note_app_spec.js +++ b/spec/javascripts/notes/components/issue_note_app_spec.js @@ -1,8 +1,10 @@ import Vue from 'vue'; import issueNotesApp from '~/notes/components/issue_notes_app.vue'; +import service from '~/notes/services/issue_notes_service'; +import { keyboardDownEvent } from '../../issue_show/helpers'; import * as mockData from '../mock_data'; -fdescribe('issue_note_app', () => { +describe('issue_note_app', () => { let mountComponent; beforeEach(() => { @@ -52,7 +54,7 @@ fdescribe('issue_note_app', () => { }); }); - fdescribe('render', () => { + describe('render', () => { let vm; const responseInterceptor = (request, next) => { @@ -73,8 +75,18 @@ fdescribe('issue_note_app', () => { afterEach(() => { Vue.http.interceptors = _.without(Vue.http.interceptors, responseInterceptor); }); - it('should render list of notes', () => { - console.log(vm); + + it('should render list of notes', (done) => { + const note = mockData.discussionResponse[0].notes[0]; + + setTimeout(() => { + expect( + vm.$el.querySelector('.main-notes-list .note-header-author-name').textContent.trim(), + ).toEqual(note.author.name); + + expect(vm.$el.querySelector('.main-notes-list .note-text').innerHTML).toEqual(note.note_html); + done(); + }, 0); }); it('should render form', () => { @@ -109,28 +121,43 @@ fdescribe('issue_note_app', () => { describe('update note', () => { describe('individual note', () => { - describe('shortup up key', () => { - it('shows correct editing form when user clicks up', () => { + let vm; + + const responseInterceptor = (request, next) => { + next(request.respondWith(JSON.stringify(mockData.discussionResponse), { + status: 200, + })); + }; + + beforeEach(() => { + Vue.http.interceptors.push(responseInterceptor); + + vm = mountComponent({ + issueData: mockData.issueDataMock, + notesData: mockData.notesDataMock, + userData: mockData.userDataMock, }); + }); - describe('dropdown', () => { - it('renders edit form', () => { - }); + afterEach(() => { + Vue.http.interceptors = _.without(Vue.http.interceptors, responseInterceptor); + }); + + it('renders edit form', () => { + setTimeout(() => { + vm.$el.querySelector('.js-note-edit').click(); + Vue.nextTick(() => { + expect(vm.$el.querySelector('.js-vue-issue-note-form')).toBeDefined(); + }); + }, 0); }); it('updates the note and resets the edit form', () => {}); }); describe('dicussion note note', () => { - describe('shortup up key', () => { - it('shows correct editing form when user clicks up', () => { - }); - }); - - describe('dropdown', () => { - it('renders edit form', () => { - }); + it('renders edit form', () => { }); it('updates the note and resets the edit form', () => {}); |
