diff options
author | Mike Greiling <mike@pixelcog.com> | 2018-10-17 02:13:26 -0500 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2018-10-17 11:18:17 -0500 |
commit | f666026d71ebefd70219d5078b1f0c83fa01f84d (patch) | |
tree | ce43feb99c12c21dd266d25de24b1768bac1d459 /spec/javascripts/issue_show | |
parent | 5a6fffcffca3dc8e4f52c90d3d18eaefd9e48aef (diff) | |
download | gitlab-ce-f666026d71ebefd70219d5078b1f0c83fa01f84d.tar.gz |
Prettify all spec files
Diffstat (limited to 'spec/javascripts/issue_show')
7 files changed, 205 insertions, 249 deletions
diff --git a/spec/javascripts/issue_show/components/app_spec.js b/spec/javascripts/issue_show/components/app_spec.js index 67d59d5cc5f..c9d2044b054 100644 --- a/spec/javascripts/issue_show/components/app_spec.js +++ b/spec/javascripts/issue_show/components/app_spec.js @@ -11,10 +11,7 @@ function formatText(text) { return text.trim().replace(/\s\s+/g, ' '); } -const REALTIME_REQUEST_STACK = [ - issueShowData.initialRequest, - issueShowData.secondRequest, -]; +const REALTIME_REQUEST_STACK = [issueShowData.initialRequest, issueShowData.secondRequest]; describe('Issuable output', () => { let mock; @@ -23,7 +20,7 @@ describe('Issuable output', () => { document.body.innerHTML = '<span id="task_status"></span>'; - beforeEach((done) => { + beforeEach(done => { spyOn(eventHub, '$emit'); const IssuableDescriptionComponent = Vue.extend(issuableApp); @@ -64,65 +61,65 @@ describe('Issuable output', () => { vm.$destroy(); }); - it('should render a title/description/edited and update title/description/edited on update', (done) => { + it('should render a title/description/edited and update title/description/edited on update', done => { let editedText; Vue.nextTick() - .then(() => { - editedText = vm.$el.querySelector('.edited-text'); - }) - .then(() => { - expect(document.querySelector('title').innerText).toContain('this is a title (#1)'); - expect(vm.$el.querySelector('.title').innerHTML).toContain('<p>this is a title</p>'); - expect(vm.$el.querySelector('.wiki').innerHTML).toContain('<p>this is a description!</p>'); - expect(vm.$el.querySelector('.js-task-list-field').value).toContain('this is a description'); - expect(formatText(editedText.innerText)).toMatch(/Edited[\s\S]+?by Some User/); - expect(editedText.querySelector('.author-link').href).toMatch(/\/some_user$/); - expect(editedText.querySelector('time')).toBeTruthy(); - }) - .then(() => { - vm.poll.makeRequest(); - }) - .then(() => new Promise(resolve => setTimeout(resolve))) - .then(() => { - expect(document.querySelector('title').innerText).toContain('2 (#1)'); - expect(vm.$el.querySelector('.title').innerHTML).toContain('<p>2</p>'); - expect(vm.$el.querySelector('.wiki').innerHTML).toContain('<p>42</p>'); - expect(vm.$el.querySelector('.js-task-list-field').value).toContain('42'); - expect(vm.$el.querySelector('.edited-text')).toBeTruthy(); - expect(formatText(vm.$el.querySelector('.edited-text').innerText)).toMatch(/Edited[\s\S]+?by Other User/); - expect(editedText.querySelector('.author-link').href).toMatch(/\/other_user$/); - expect(editedText.querySelector('time')).toBeTruthy(); - }) - .then(done) - .catch(done.fail); + .then(() => { + editedText = vm.$el.querySelector('.edited-text'); + }) + .then(() => { + expect(document.querySelector('title').innerText).toContain('this is a title (#1)'); + expect(vm.$el.querySelector('.title').innerHTML).toContain('<p>this is a title</p>'); + expect(vm.$el.querySelector('.wiki').innerHTML).toContain('<p>this is a description!</p>'); + expect(vm.$el.querySelector('.js-task-list-field').value).toContain( + 'this is a description', + ); + expect(formatText(editedText.innerText)).toMatch(/Edited[\s\S]+?by Some User/); + expect(editedText.querySelector('.author-link').href).toMatch(/\/some_user$/); + expect(editedText.querySelector('time')).toBeTruthy(); + }) + .then(() => { + vm.poll.makeRequest(); + }) + .then(() => new Promise(resolve => setTimeout(resolve))) + .then(() => { + expect(document.querySelector('title').innerText).toContain('2 (#1)'); + expect(vm.$el.querySelector('.title').innerHTML).toContain('<p>2</p>'); + expect(vm.$el.querySelector('.wiki').innerHTML).toContain('<p>42</p>'); + expect(vm.$el.querySelector('.js-task-list-field').value).toContain('42'); + expect(vm.$el.querySelector('.edited-text')).toBeTruthy(); + expect(formatText(vm.$el.querySelector('.edited-text').innerText)).toMatch( + /Edited[\s\S]+?by Other User/, + ); + expect(editedText.querySelector('.author-link').href).toMatch(/\/other_user$/); + expect(editedText.querySelector('time')).toBeTruthy(); + }) + .then(done) + .catch(done.fail); }); - it('shows actions if permissions are correct', (done) => { + it('shows actions if permissions are correct', done => { vm.showForm = true; Vue.nextTick(() => { - expect( - vm.$el.querySelector('.btn'), - ).not.toBeNull(); + expect(vm.$el.querySelector('.btn')).not.toBeNull(); done(); }); }); - it('does not show actions if permissions are incorrect', (done) => { + it('does not show actions if permissions are incorrect', done => { vm.showForm = true; vm.canUpdate = false; Vue.nextTick(() => { - expect( - vm.$el.querySelector('.btn'), - ).toBeNull(); + expect(vm.$el.querySelector('.btn')).toBeNull(); done(); }); }); - it('does not update formState if form is already open', (done) => { + it('does not update formState if form is already open', done => { vm.openForm(); vm.state.titleText = 'testing 123'; @@ -130,25 +127,26 @@ describe('Issuable output', () => { vm.openForm(); Vue.nextTick(() => { - expect( - vm.store.formState.title, - ).not.toBe('testing 123'); + expect(vm.store.formState.title).not.toBe('testing 123'); done(); }); }); describe('updateIssuable', () => { - it('fetches new data after update', (done) => { + it('fetches new data after update', done => { spyOn(vm.service, 'getData').and.callThrough(); - spyOn(vm.service, 'updateIssuable').and.callFake(() => new Promise((resolve) => { - resolve({ - data: { - confidential: false, - web_url: window.location.pathname, - }, - }); - })); + spyOn(vm.service, 'updateIssuable').and.callFake( + () => + new Promise(resolve => { + resolve({ + data: { + confidential: false, + web_url: window.location.pathname, + }, + }); + }), + ); vm.updateIssuable() .then(() => { @@ -158,10 +156,13 @@ describe('Issuable output', () => { .catch(done.fail); }); - it('correctly updates issuable data', (done) => { - spyOn(vm.service, 'updateIssuable').and.callFake(() => new Promise((resolve) => { - resolve(); - })); + it('correctly updates issuable data', done => { + spyOn(vm.service, 'updateIssuable').and.callFake( + () => + new Promise(resolve => { + resolve(); + }), + ); vm.updateIssuable() .then(() => { @@ -172,16 +173,19 @@ describe('Issuable output', () => { .catch(done.fail); }); - it('does not redirect if issue has not moved', (done) => { + it('does not redirect if issue has not moved', done => { const visitUrl = spyOnDependency(issuableApp, 'visitUrl'); - spyOn(vm.service, 'updateIssuable').and.callFake(() => new Promise((resolve) => { - resolve({ - data: { - web_url: window.location.pathname, - confidential: vm.isConfidential, - }, - }); - })); + spyOn(vm.service, 'updateIssuable').and.callFake( + () => + new Promise(resolve => { + resolve({ + data: { + web_url: window.location.pathname, + confidential: vm.isConfidential, + }, + }); + }), + ); vm.updateIssuable(); @@ -191,16 +195,19 @@ describe('Issuable output', () => { }); }); - it('redirects if returned web_url has changed', (done) => { + it('redirects if returned web_url has changed', done => { const visitUrl = spyOnDependency(issuableApp, 'visitUrl'); - spyOn(vm.service, 'updateIssuable').and.callFake(() => new Promise((resolve) => { - resolve({ - data: { - web_url: '/testing-issue-move', - confidential: vm.isConfidential, - }, - }); - })); + spyOn(vm.service, 'updateIssuable').and.callFake( + () => + new Promise(resolve => { + resolve({ + data: { + web_url: '/testing-issue-move', + confidential: vm.isConfidential, + }, + }); + }), + ); vm.updateIssuable(); @@ -211,7 +218,7 @@ describe('Issuable output', () => { }); describe('shows dialog when issue has unsaved changed', () => { - it('confirms on title change', (done) => { + it('confirms on title change', done => { vm.showForm = true; vm.state.titleText = 'title has changed'; const e = { returnValue: null }; @@ -222,7 +229,7 @@ describe('Issuable output', () => { }); }); - it('confirms on description change', (done) => { + it('confirms on description change', done => { vm.showForm = true; vm.state.descriptionText = 'description has changed'; const e = { returnValue: null }; @@ -233,7 +240,7 @@ describe('Issuable output', () => { }); }); - it('does nothing when nothing has changed', (done) => { + it('does nothing when nothing has changed', done => { const e = { returnValue: null }; vm.handleBeforeUnloadEvent(e); Vue.nextTick(() => { @@ -246,41 +253,36 @@ describe('Issuable output', () => { describe('error when updating', () => { beforeEach(() => { spyOn(window, 'Flash').and.callThrough(); - spyOn(vm.service, 'updateIssuable').and.callFake(() => new Promise((resolve, reject) => { - reject(); - })); + spyOn(vm.service, 'updateIssuable').and.callFake( + () => + new Promise((resolve, reject) => { + reject(); + }), + ); }); - it('closes form on error', (done) => { + it('closes form on error', done => { vm.updateIssuable(); setTimeout(() => { - expect( - eventHub.$emit, - ).toHaveBeenCalledWith('close.form'); + expect(eventHub.$emit).toHaveBeenCalledWith('close.form'); - expect( - window.Flash, - ).toHaveBeenCalledWith('Error updating issue'); + expect(window.Flash).toHaveBeenCalledWith('Error updating issue'); done(); }); }); - it('returns the correct error message for issuableType', (done) => { + it('returns the correct error message for issuableType', done => { vm.issuableType = 'merge request'; Vue.nextTick(() => { vm.updateIssuable(); setTimeout(() => { - expect( - eventHub.$emit, - ).toHaveBeenCalledWith('close.form'); + expect(eventHub.$emit).toHaveBeenCalledWith('close.form'); - expect( - window.Flash, - ).toHaveBeenCalledWith('Error updating merge request'); + expect(window.Flash).toHaveBeenCalledWith('Error updating merge request'); done(); }); @@ -289,16 +291,17 @@ describe('Issuable output', () => { }); }); - it('opens recaptcha modal if update rejected as spam', (done) => { + it('opens recaptcha modal if update rejected as spam', done => { function mockScriptSrc() { - const recaptchaChild = vm.$children - .find(child => child.$options._componentTag === 'recaptcha-modal'); // eslint-disable-line no-underscore-dangle + const recaptchaChild = vm.$children.find( + child => child.$options._componentTag === 'recaptcha-modal', + ); // eslint-disable-line no-underscore-dangle recaptchaChild.scriptSrc = '//scriptsrc'; } let modal; - const promise = new Promise((resolve) => { + const promise = new Promise(resolve => { resolve({ data: { recaptcha_html: '<div class="g-recaptcha">recaptcha_html</div>', @@ -334,15 +337,18 @@ describe('Issuable output', () => { }); describe('deleteIssuable', () => { - it('changes URL when deleted', (done) => { + it('changes URL when deleted', done => { const visitUrl = spyOnDependency(issuableApp, 'visitUrl'); - spyOn(vm.service, 'deleteIssuable').and.callFake(() => new Promise((resolve) => { - resolve({ - data: { - web_url: '/test', - }, - }); - })); + spyOn(vm.service, 'deleteIssuable').and.callFake( + () => + new Promise(resolve => { + resolve({ + data: { + web_url: '/test', + }, + }); + }), + ); vm.deleteIssuable(); @@ -352,43 +358,43 @@ describe('Issuable output', () => { }); }); - it('stops polling when deleting', (done) => { + it('stops polling when deleting', done => { spyOnDependency(issuableApp, 'visitUrl'); spyOn(vm.poll, 'stop').and.callThrough(); - spyOn(vm.service, 'deleteIssuable').and.callFake(() => new Promise((resolve) => { - resolve({ - data: { - web_url: '/test', - }, - }); - })); + spyOn(vm.service, 'deleteIssuable').and.callFake( + () => + new Promise(resolve => { + resolve({ + data: { + web_url: '/test', + }, + }); + }), + ); vm.deleteIssuable(); setTimeout(() => { - expect( - vm.poll.stop, - ).toHaveBeenCalledWith(); + expect(vm.poll.stop).toHaveBeenCalledWith(); done(); }); }); - it('closes form on error', (done) => { + it('closes form on error', done => { spyOn(window, 'Flash').and.callThrough(); - spyOn(vm.service, 'deleteIssuable').and.callFake(() => new Promise((resolve, reject) => { - reject(); - })); + spyOn(vm.service, 'deleteIssuable').and.callFake( + () => + new Promise((resolve, reject) => { + reject(); + }), + ); vm.deleteIssuable(); setTimeout(() => { - expect( - eventHub.$emit, - ).toHaveBeenCalledWith('close.form'); + expect(eventHub.$emit).toHaveBeenCalledWith('close.form'); - expect( - window.Flash, - ).toHaveBeenCalledWith('Error deleting issue'); + expect(window.Flash).toHaveBeenCalledWith('Error deleting issue'); done(); }); @@ -396,7 +402,7 @@ describe('Issuable output', () => { }); describe('open form', () => { - it('shows locked warning if form is open & data is different', (done) => { + it('shows locked warning if form is open & data is different', done => { vm.$nextTick() .then(() => { vm.openForm(); diff --git a/spec/javascripts/issue_show/components/description_spec.js b/spec/javascripts/issue_show/components/description_spec.js index 889c8545faa..6a4de8ffa1a 100644 --- a/spec/javascripts/issue_show/components/description_spec.js +++ b/spec/javascripts/issue_show/components/description_spec.js @@ -33,7 +33,7 @@ describe('Description component', () => { vm.$destroy(); }); - it('animates description changes', (done) => { + it('animates description changes', done => { vm.descriptionHtml = 'changed'; Vue.nextTick(() => { @@ -51,10 +51,11 @@ describe('Description component', () => { }); }); - it('opens recaptcha dialog if update rejected as spam', (done) => { + it('opens recaptcha dialog if update rejected as spam', done => { let modal; - const recaptchaChild = vm.$children - .find(child => child.$options._componentTag === 'recaptcha-modal'); // eslint-disable-line no-underscore-dangle + const recaptchaChild = vm.$children.find( + child => child.$options._componentTag === 'recaptcha-modal', + ); // eslint-disable-line no-underscore-dangle recaptchaChild.scriptSrc = '//scriptsrc'; @@ -84,13 +85,16 @@ describe('Description component', () => { let TaskList; beforeEach(() => { - vm = mountComponent(DescriptionComponent, Object.assign({}, props, { - issuableType: 'issuableType', - })); + vm = mountComponent( + DescriptionComponent, + Object.assign({}, props, { + issuableType: 'issuableType', + }), + ); TaskList = spyOnDependency(Description, 'TaskList'); }); - it('re-inits the TaskList when description changed', (done) => { + it('re-inits the TaskList when description changed', done => { vm.descriptionHtml = 'changed'; setTimeout(() => { @@ -99,7 +103,7 @@ describe('Description component', () => { }); }); - it('does not re-init the TaskList when canUpdate is false', (done) => { + it('does not re-init the TaskList when canUpdate is false', done => { vm.canUpdate = false; vm.descriptionHtml = 'changed'; @@ -109,7 +113,7 @@ describe('Description component', () => { }); }); - it('calls with issuableType dataType', (done) => { + it('calls with issuableType dataType', done => { vm.descriptionHtml = 'changed'; setTimeout(() => { @@ -125,44 +129,42 @@ describe('Description component', () => { }); describe('taskStatus', () => { - it('adds full taskStatus', (done) => { + it('adds full taskStatus', done => { vm.taskStatus = '1 of 1'; setTimeout(() => { - expect( - document.querySelector('.issuable-meta #task_status').textContent.trim(), - ).toBe('1 of 1'); + expect(document.querySelector('.issuable-meta #task_status').textContent.trim()).toBe( + '1 of 1', + ); done(); }); }); - it('adds short taskStatus', (done) => { + it('adds short taskStatus', done => { vm.taskStatus = '1 of 1'; setTimeout(() => { - expect( - document.querySelector('.issuable-meta #task_status_short').textContent.trim(), - ).toBe('1/1 task'); + expect(document.querySelector('.issuable-meta #task_status_short').textContent.trim()).toBe( + '1/1 task', + ); done(); }); }); - it('clears task status text when no tasks are present', (done) => { + it('clears task status text when no tasks are present', done => { vm.taskStatus = '0 of 0'; setTimeout(() => { - expect( - document.querySelector('.issuable-meta #task_status').textContent.trim(), - ).toBe(''); + expect(document.querySelector('.issuable-meta #task_status').textContent.trim()).toBe(''); done(); }); }); }); - it('applies syntax highlighting and math when description changed', (done) => { + it('applies syntax highlighting and math when description changed', done => { spyOn(vm, 'renderGFM').and.callThrough(); spyOn($.prototype, 'renderGFM').and.callThrough(); vm.descriptionHtml = 'changed'; diff --git a/spec/javascripts/issue_show/components/edit_actions_spec.js b/spec/javascripts/issue_show/components/edit_actions_spec.js index 4f4dae87efe..d92c54ea83f 100644 --- a/spec/javascripts/issue_show/components/edit_actions_spec.js +++ b/spec/javascripts/issue_show/components/edit_actions_spec.js @@ -6,7 +6,7 @@ import Store from '~/issue_show/stores'; describe('Edit Actions components', () => { let vm; - beforeEach((done) => { + beforeEach(done => { const Component = Vue.extend(editActions); const store = new Store({ titleHtml: '', @@ -29,40 +29,32 @@ describe('Edit Actions components', () => { }); it('renders all buttons as enabled', () => { - expect( - vm.$el.querySelectorAll('.disabled').length, - ).toBe(0); + expect(vm.$el.querySelectorAll('.disabled').length).toBe(0); - expect( - vm.$el.querySelectorAll('[disabled]').length, - ).toBe(0); + expect(vm.$el.querySelectorAll('[disabled]').length).toBe(0); }); - it('does not render delete button if canUpdate is false', (done) => { + it('does not render delete button if canUpdate is false', done => { vm.canDestroy = false; Vue.nextTick(() => { - expect( - vm.$el.querySelector('.btn-danger'), - ).toBeNull(); + expect(vm.$el.querySelector('.btn-danger')).toBeNull(); done(); }); }); - it('disables submit button when title is blank', (done) => { + it('disables submit button when title is blank', done => { vm.formState.title = ''; Vue.nextTick(() => { - expect( - vm.$el.querySelector('.btn-success').getAttribute('disabled'), - ).toBe('disabled'); + expect(vm.$el.querySelector('.btn-success').getAttribute('disabled')).toBe('disabled'); done(); }); }); - it('should not show delete button if showDeleteButton is false', (done) => { + it('should not show delete button if showDeleteButton is false', done => { vm.showDeleteButton = false; Vue.nextTick(() => { @@ -75,30 +67,24 @@ describe('Edit Actions components', () => { it('sends update.issauble event when clicking save button', () => { vm.$el.querySelector('.btn-success').click(); - expect( - eventHub.$emit, - ).toHaveBeenCalledWith('update.issuable'); + expect(eventHub.$emit).toHaveBeenCalledWith('update.issuable'); }); - it('shows loading icon after clicking save button', (done) => { + it('shows loading icon after clicking save button', done => { vm.$el.querySelector('.btn-success').click(); Vue.nextTick(() => { - expect( - vm.$el.querySelector('.btn-success .fa'), - ).not.toBeNull(); + expect(vm.$el.querySelector('.btn-success .fa')).not.toBeNull(); done(); }); }); - it('disabled button after clicking save button', (done) => { + it('disabled button after clicking save button', done => { vm.$el.querySelector('.btn-success').click(); Vue.nextTick(() => { - expect( - vm.$el.querySelector('.btn-success').getAttribute('disabled'), - ).toBe('disabled'); + expect(vm.$el.querySelector('.btn-success').getAttribute('disabled')).toBe('disabled'); done(); }); @@ -109,9 +95,7 @@ describe('Edit Actions components', () => { it('emits close.form when clicking cancel', () => { vm.$el.querySelector('.btn-default').click(); - expect( - eventHub.$emit, - ).toHaveBeenCalledWith('close.form'); + expect(eventHub.$emit).toHaveBeenCalledWith('close.form'); }); }); @@ -120,36 +104,28 @@ describe('Edit Actions components', () => { spyOn(window, 'confirm').and.returnValue(true); vm.$el.querySelector('.btn-danger').click(); - expect( - eventHub.$emit, - ).toHaveBeenCalledWith('delete.issuable'); + expect(eventHub.$emit).toHaveBeenCalledWith('delete.issuable'); }); - it('shows loading icon after clicking delete button', (done) => { + it('shows loading icon after clicking delete button', done => { spyOn(window, 'confirm').and.returnValue(true); vm.$el.querySelector('.btn-danger').click(); Vue.nextTick(() => { - expect( - vm.$el.querySelector('.btn-danger .fa'), - ).not.toBeNull(); + expect(vm.$el.querySelector('.btn-danger .fa')).not.toBeNull(); done(); }); }); - it('does no actions when confirm is false', (done) => { + it('does no actions when confirm is false', done => { spyOn(window, 'confirm').and.returnValue(false); vm.$el.querySelector('.btn-danger').click(); Vue.nextTick(() => { - expect( - eventHub.$emit, - ).not.toHaveBeenCalledWith('delete.issuable'); + expect(eventHub.$emit).not.toHaveBeenCalledWith('delete.issuable'); - expect( - vm.$el.querySelector('.btn-danger .fa'), - ).toBeNull(); + expect(vm.$el.querySelector('.btn-danger .fa')).toBeNull(); done(); }); diff --git a/spec/javascripts/issue_show/components/fields/description_spec.js b/spec/javascripts/issue_show/components/fields/description_spec.js index 299f88e7778..2c3efc8d4d4 100644 --- a/spec/javascripts/issue_show/components/fields/description_spec.js +++ b/spec/javascripts/issue_show/components/fields/description_spec.js @@ -8,7 +8,7 @@ describe('Description field component', () => { let vm; let store; - beforeEach((done) => { + beforeEach(done => { const Component = Vue.extend(descriptionField); const el = document.createElement('div'); store = new Store({ @@ -35,42 +35,32 @@ describe('Description field component', () => { }); it('renders markdown field with description', () => { - expect( - vm.$el.querySelector('.md-area textarea').value, - ).toBe('test'); + expect(vm.$el.querySelector('.md-area textarea').value).toBe('test'); }); - it('renders markdown field with a markdown description', (done) => { + it('renders markdown field with a markdown description', done => { store.formState.description = '**test**'; Vue.nextTick(() => { - expect( - vm.$el.querySelector('.md-area textarea').value, - ).toBe('**test**'); + expect(vm.$el.querySelector('.md-area textarea').value).toBe('**test**'); done(); }); }); it('focuses field when mounted', () => { - expect( - document.activeElement, - ).toBe(vm.$refs.textarea); + expect(document.activeElement).toBe(vm.$refs.textarea); }); it('triggers update with meta+enter', () => { vm.$el.querySelector('.md-area textarea').dispatchEvent(keyboardDownEvent(13, true)); - expect( - eventHub.$emit, - ).toHaveBeenCalled(); + expect(eventHub.$emit).toHaveBeenCalled(); }); it('triggers update with ctrl+enter', () => { vm.$el.querySelector('.md-area textarea').dispatchEvent(keyboardDownEvent(13, false, true)); - expect( - eventHub.$emit, - ).toHaveBeenCalled(); + expect(eventHub.$emit).toHaveBeenCalled(); }); }); diff --git a/spec/javascripts/issue_show/components/fields/description_template_spec.js b/spec/javascripts/issue_show/components/fields/description_template_spec.js index 30441faf844..8d77a620d76 100644 --- a/spec/javascripts/issue_show/components/fields/description_template_spec.js +++ b/spec/javascripts/issue_show/components/fields/description_template_spec.js @@ -5,7 +5,7 @@ describe('Issue description template component', () => { let vm; let formState; - beforeEach((done) => { + beforeEach(done => { const Component = Vue.extend(descriptionTemplate); formState = { description: 'test', @@ -24,24 +24,20 @@ describe('Issue description template component', () => { }); it('renders templates as JSON array in data attribute', () => { - expect( - vm.$el.querySelector('.js-issuable-selector').getAttribute('data-data'), - ).toBe('[{"name":"test"}]'); + expect(vm.$el.querySelector('.js-issuable-selector').getAttribute('data-data')).toBe( + '[{"name":"test"}]', + ); }); it('updates formState when changing template', () => { vm.issuableTemplate.editor.setValue('test new template'); - expect( - formState.description, - ).toBe('test new template'); + expect(formState.description).toBe('test new template'); }); it('returns formState description with editor getValue', () => { formState.description = 'testing new template'; - expect( - vm.issuableTemplate.editor.getValue(), - ).toBe('testing new template'); + expect(vm.issuableTemplate.editor.getValue()).toBe('testing new template'); }); }); diff --git a/spec/javascripts/issue_show/components/fields/title_spec.js b/spec/javascripts/issue_show/components/fields/title_spec.js index a03b462689f..4b96a1feb29 100644 --- a/spec/javascripts/issue_show/components/fields/title_spec.js +++ b/spec/javascripts/issue_show/components/fields/title_spec.js @@ -27,24 +27,18 @@ describe('Title field component', () => { }); it('renders form control with formState title', () => { - expect( - vm.$el.querySelector('.form-control').value, - ).toBe('test'); + expect(vm.$el.querySelector('.form-control').value).toBe('test'); }); it('triggers update with meta+enter', () => { vm.$el.querySelector('.form-control').dispatchEvent(keyboardDownEvent(13, true)); - expect( - eventHub.$emit, - ).toHaveBeenCalled(); + expect(eventHub.$emit).toHaveBeenCalled(); }); it('triggers update with ctrl+enter', () => { vm.$el.querySelector('.form-control').dispatchEvent(keyboardDownEvent(13, false, true)); - expect( - eventHub.$emit, - ).toHaveBeenCalled(); + expect(eventHub.$emit).toHaveBeenCalled(); }); }); diff --git a/spec/javascripts/issue_show/components/form_spec.js b/spec/javascripts/issue_show/components/form_spec.js index eaac1e3536d..523954013cf 100644 --- a/spec/javascripts/issue_show/components/form_spec.js +++ b/spec/javascripts/issue_show/components/form_spec.js @@ -4,7 +4,7 @@ import formComponent from '~/issue_show/components/form.vue'; describe('Inline edit form component', () => { let vm; - beforeEach((done) => { + beforeEach(done => { const Component = Vue.extend(formComponent); vm = new Component({ @@ -27,36 +27,28 @@ describe('Inline edit form component', () => { }); it('does not render template selector if no templates exist', () => { - expect( - vm.$el.querySelector('.js-issuable-selector-wrap'), - ).toBeNull(); + expect(vm.$el.querySelector('.js-issuable-selector-wrap')).toBeNull(); }); - it('renders template selector when templates exists', (done) => { + it('renders template selector when templates exists', done => { vm.issuableTemplates = ['test']; Vue.nextTick(() => { - expect( - vm.$el.querySelector('.js-issuable-selector-wrap'), - ).not.toBeNull(); + expect(vm.$el.querySelector('.js-issuable-selector-wrap')).not.toBeNull(); done(); }); }); it('hides locked warning by default', () => { - expect( - vm.$el.querySelector('.alert'), - ).toBeNull(); + expect(vm.$el.querySelector('.alert')).toBeNull(); }); - it('shows locked warning if formState is different', (done) => { + it('shows locked warning if formState is different', done => { vm.formState.lockedWarningVisible = true; Vue.nextTick(() => { - expect( - vm.$el.querySelector('.alert'), - ).not.toBeNull(); + expect(vm.$el.querySelector('.alert')).not.toBeNull(); done(); }); |