From bbcea8b6062a712fa4d457c0d69d6fc5897e5c3d Mon Sep 17 00:00:00 2001 From: Simon Knox Date: Thu, 30 Nov 2017 19:13:26 +1100 Subject: fix import order lint --- .../notes/components/comment_form_spec.js | 2 +- .../vue_shared/notes/components/note_form_spec.js | 2 +- .../components/notes/placeholder_note_spec.js | 39 --------------- .../notes/placeholder_system_note_spec.js | 25 ---------- .../notes/components/notes/system_note_spec.js | 57 ---------------------- .../notes/components/placeholder_note_spec.js | 39 +++++++++++++++ .../components/placeholder_system_note_spec.js | 25 ++++++++++ .../notes/components/system_note_spec.js | 57 ++++++++++++++++++++++ .../vue_shared/notes/stores/actions_spec.js | 2 +- 9 files changed, 124 insertions(+), 124 deletions(-) delete mode 100644 spec/javascripts/vue_shared/notes/components/notes/placeholder_note_spec.js delete mode 100644 spec/javascripts/vue_shared/notes/components/notes/placeholder_system_note_spec.js delete mode 100644 spec/javascripts/vue_shared/notes/components/notes/system_note_spec.js create mode 100644 spec/javascripts/vue_shared/notes/components/placeholder_note_spec.js create mode 100644 spec/javascripts/vue_shared/notes/components/placeholder_system_note_spec.js create mode 100644 spec/javascripts/vue_shared/notes/components/system_note_spec.js (limited to 'spec/javascripts/vue_shared/notes') diff --git a/spec/javascripts/vue_shared/notes/components/comment_form_spec.js b/spec/javascripts/vue_shared/notes/components/comment_form_spec.js index 516e1b1b192..7741c99f78d 100644 --- a/spec/javascripts/vue_shared/notes/components/comment_form_spec.js +++ b/spec/javascripts/vue_shared/notes/components/comment_form_spec.js @@ -3,7 +3,7 @@ import Autosize from 'autosize'; import store from '~/vue_shared/notes/stores'; import issueCommentForm from '~/vue_shared/notes/components/comment_form.vue'; import { loggedOutnoteableData, notesDataMock, userDataMock, noteableDataMock } from '../mock_data'; -import { keyboardDownEvent } from '../../issue_show/helpers'; +import { keyboardDownEvent } from '../../../issue_show/helpers'; describe('issue_comment_form component', () => { let vm; diff --git a/spec/javascripts/vue_shared/notes/components/note_form_spec.js b/spec/javascripts/vue_shared/notes/components/note_form_spec.js index 4c56057b448..2819e07a3ca 100644 --- a/spec/javascripts/vue_shared/notes/components/note_form_spec.js +++ b/spec/javascripts/vue_shared/notes/components/note_form_spec.js @@ -2,7 +2,7 @@ import Vue from 'vue'; import store from '~/vue_shared/notes/stores'; import issueNoteForm from '~/vue_shared/notes/components/note_form.vue'; import { noteableDataMock, notesDataMock } from '../mock_data'; -import { keyboardDownEvent } from '../../issue_show/helpers'; +import { keyboardDownEvent } from '../../../issue_show/helpers'; describe('issue_note_form component', () => { let vm; diff --git a/spec/javascripts/vue_shared/notes/components/notes/placeholder_note_spec.js b/spec/javascripts/vue_shared/notes/components/notes/placeholder_note_spec.js deleted file mode 100644 index 7c4123e70ed..00000000000 --- a/spec/javascripts/vue_shared/notes/components/notes/placeholder_note_spec.js +++ /dev/null @@ -1,39 +0,0 @@ -import Vue from 'vue'; -import issuePlaceholderNote from '~/vue_shared/notes/components/placeholder_note.vue'; -import store from '~/vue_shared/notes/stores'; -import { userDataMock } from '../../../notes/mock_data'; - -describe('issue placeholder system note component', () => { - let vm; - - beforeEach(() => { - const Component = Vue.extend(issuePlaceholderNote); - store.dispatch('setUserData', userDataMock); - vm = new Component({ - store, - propsData: { note: { body: 'Foo' } }, - }).$mount(); - }); - - afterEach(() => { - vm.$destroy(); - }); - - describe('user information', () => { - it('should render user avatar with link', () => { - expect(vm.$el.querySelector('.user-avatar-link').getAttribute('href')).toEqual(userDataMock.path); - expect(vm.$el.querySelector('.user-avatar-link img').getAttribute('src')).toEqual(userDataMock.avatar_url); - }); - }); - - describe('note content', () => { - it('should render note header information', () => { - expect(vm.$el.querySelector('.note-header-info a').getAttribute('href')).toEqual(userDataMock.path); - expect(vm.$el.querySelector('.note-header-info .note-headline-light').textContent.trim()).toEqual(`@${userDataMock.username}`); - }); - - it('should render note body', () => { - expect(vm.$el.querySelector('.note-text p').textContent.trim()).toEqual('Foo'); - }); - }); -}); diff --git a/spec/javascripts/vue_shared/notes/components/notes/placeholder_system_note_spec.js b/spec/javascripts/vue_shared/notes/components/notes/placeholder_system_note_spec.js deleted file mode 100644 index 2b7398bcefe..00000000000 --- a/spec/javascripts/vue_shared/notes/components/notes/placeholder_system_note_spec.js +++ /dev/null @@ -1,25 +0,0 @@ -import Vue from 'vue'; -import placeholderSystemNote from '~/vue_shared/notes/components/placeholder_system_note.vue'; -import mountComponent from '../../../helpers/vue_mount_component_helper'; - -describe('placeholder system note component', () => { - let PlaceholderSystemNote; - let vm; - - beforeEach(() => { - PlaceholderSystemNote = Vue.extend(placeholderSystemNote); - }); - - afterEach(() => { - vm.$destroy(); - }); - - it('should render system note placeholder with plain text', () => { - vm = mountComponent(PlaceholderSystemNote, { - note: { body: 'This is a placeholder' }, - }); - - expect(vm.$el.tagName).toEqual('LI'); - expect(vm.$el.querySelector('.timeline-content em').textContent.trim()).toEqual('This is a placeholder'); - }); -}); diff --git a/spec/javascripts/vue_shared/notes/components/notes/system_note_spec.js b/spec/javascripts/vue_shared/notes/components/notes/system_note_spec.js deleted file mode 100644 index 60e591d9d5f..00000000000 --- a/spec/javascripts/vue_shared/notes/components/notes/system_note_spec.js +++ /dev/null @@ -1,57 +0,0 @@ -import Vue from 'vue'; -import issueSystemNote from '~/vue_shared/notes/components/system_note.vue'; -import store from '~/vue_shared/notes/stores'; - -describe('issue system note', () => { - let vm; - let props; - - beforeEach(() => { - props = { - note: { - id: 1424, - author: { - id: 1, - name: 'Root', - username: 'root', - state: 'active', - avatar_url: 'path', - path: '/root', - }, - note_html: '

closed

', - system_note_icon_name: 'icon_status_closed', - created_at: '2017-08-02T10:51:58.559Z', - }, - }; - - store.dispatch('setTargetNoteHash', `note_${props.note.id}`); - - const Component = Vue.extend(issueSystemNote); - vm = new Component({ - store, - propsData: props, - }).$mount(); - }); - - afterEach(() => { - vm.$destroy(); - }); - - it('should render a list item with correct id', () => { - expect(vm.$el.getAttribute('id')).toEqual(`note_${props.note.id}`); - }); - - it('should render target class is note is target note', () => { - expect(vm.$el.classList).toContain('target'); - }); - - it('should render svg icon', () => { - expect(vm.$el.querySelector('.timeline-icon svg')).toBeDefined(); - }); - - it('should render note header component', () => { - expect( - vm.$el.querySelector('.system-note-message').innerHTML, - ).toEqual(props.note.note_html); - }); -}); diff --git a/spec/javascripts/vue_shared/notes/components/placeholder_note_spec.js b/spec/javascripts/vue_shared/notes/components/placeholder_note_spec.js new file mode 100644 index 00000000000..6d19d2154e3 --- /dev/null +++ b/spec/javascripts/vue_shared/notes/components/placeholder_note_spec.js @@ -0,0 +1,39 @@ +import Vue from 'vue'; +import issuePlaceholderNote from '~/vue_shared/notes/components/placeholder_note.vue'; +import store from '~/vue_shared/notes/stores'; +import { userDataMock } from '../mock_data'; + +describe('issue placeholder system note component', () => { + let vm; + + beforeEach(() => { + const Component = Vue.extend(issuePlaceholderNote); + store.dispatch('setUserData', userDataMock); + vm = new Component({ + store, + propsData: { note: { body: 'Foo' } }, + }).$mount(); + }); + + afterEach(() => { + vm.$destroy(); + }); + + describe('user information', () => { + it('should render user avatar with link', () => { + expect(vm.$el.querySelector('.user-avatar-link').getAttribute('href')).toEqual(userDataMock.path); + expect(vm.$el.querySelector('.user-avatar-link img').getAttribute('src')).toEqual(userDataMock.avatar_url); + }); + }); + + describe('note content', () => { + it('should render note header information', () => { + expect(vm.$el.querySelector('.note-header-info a').getAttribute('href')).toEqual(userDataMock.path); + expect(vm.$el.querySelector('.note-header-info .note-headline-light').textContent.trim()).toEqual(`@${userDataMock.username}`); + }); + + it('should render note body', () => { + expect(vm.$el.querySelector('.note-text p').textContent.trim()).toEqual('Foo'); + }); + }); +}); diff --git a/spec/javascripts/vue_shared/notes/components/placeholder_system_note_spec.js b/spec/javascripts/vue_shared/notes/components/placeholder_system_note_spec.js new file mode 100644 index 00000000000..2b7398bcefe --- /dev/null +++ b/spec/javascripts/vue_shared/notes/components/placeholder_system_note_spec.js @@ -0,0 +1,25 @@ +import Vue from 'vue'; +import placeholderSystemNote from '~/vue_shared/notes/components/placeholder_system_note.vue'; +import mountComponent from '../../../helpers/vue_mount_component_helper'; + +describe('placeholder system note component', () => { + let PlaceholderSystemNote; + let vm; + + beforeEach(() => { + PlaceholderSystemNote = Vue.extend(placeholderSystemNote); + }); + + afterEach(() => { + vm.$destroy(); + }); + + it('should render system note placeholder with plain text', () => { + vm = mountComponent(PlaceholderSystemNote, { + note: { body: 'This is a placeholder' }, + }); + + expect(vm.$el.tagName).toEqual('LI'); + expect(vm.$el.querySelector('.timeline-content em').textContent.trim()).toEqual('This is a placeholder'); + }); +}); diff --git a/spec/javascripts/vue_shared/notes/components/system_note_spec.js b/spec/javascripts/vue_shared/notes/components/system_note_spec.js new file mode 100644 index 00000000000..60e591d9d5f --- /dev/null +++ b/spec/javascripts/vue_shared/notes/components/system_note_spec.js @@ -0,0 +1,57 @@ +import Vue from 'vue'; +import issueSystemNote from '~/vue_shared/notes/components/system_note.vue'; +import store from '~/vue_shared/notes/stores'; + +describe('issue system note', () => { + let vm; + let props; + + beforeEach(() => { + props = { + note: { + id: 1424, + author: { + id: 1, + name: 'Root', + username: 'root', + state: 'active', + avatar_url: 'path', + path: '/root', + }, + note_html: '

closed

', + system_note_icon_name: 'icon_status_closed', + created_at: '2017-08-02T10:51:58.559Z', + }, + }; + + store.dispatch('setTargetNoteHash', `note_${props.note.id}`); + + const Component = Vue.extend(issueSystemNote); + vm = new Component({ + store, + propsData: props, + }).$mount(); + }); + + afterEach(() => { + vm.$destroy(); + }); + + it('should render a list item with correct id', () => { + expect(vm.$el.getAttribute('id')).toEqual(`note_${props.note.id}`); + }); + + it('should render target class is note is target note', () => { + expect(vm.$el.classList).toContain('target'); + }); + + it('should render svg icon', () => { + expect(vm.$el.querySelector('.timeline-icon svg')).toBeDefined(); + }); + + it('should render note header component', () => { + expect( + vm.$el.querySelector('.system-note-message').innerHTML, + ).toEqual(props.note.note_html); + }); +}); diff --git a/spec/javascripts/vue_shared/notes/stores/actions_spec.js b/spec/javascripts/vue_shared/notes/stores/actions_spec.js index 46b4f5f2163..a5fa36a353f 100644 --- a/spec/javascripts/vue_shared/notes/stores/actions_spec.js +++ b/spec/javascripts/vue_shared/notes/stores/actions_spec.js @@ -1,5 +1,5 @@ import * as actions from '~/vue_shared/notes/stores/actions'; -import testAction from '../../helpers/vuex_action_helper'; +import testAction from '../../../helpers/vuex_action_helper'; import { discussionMock, notesDataMock, userDataMock, noteableDataMock, individualNote } from '../mock_data'; describe('Actions Notes Store', () => { -- cgit v1.2.1