Commit e37a6d7a authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 32 files - 71 of 73

Part of our prettier migration; changing the arrow-parens style.
parent dff561fa
...@@ -2256,40 +2256,6 @@ spec/frontend/shared/popover_spec.js ...@@ -2256,40 +2256,6 @@ spec/frontend/shared/popover_spec.js
spec/frontend/shortcuts_spec.js spec/frontend/shortcuts_spec.js
spec/frontend/sidebar/assignee_title_spec.js spec/frontend/sidebar/assignee_title_spec.js
## trusting-antonelli
spec/frontend/vue_shared/components/content_viewer/viewers/markdown_viewer_spec.js
spec/frontend/vue_shared/components/date_time_picker/date_time_picker_lib_spec.js
spec/frontend/vue_shared/components/date_time_picker/date_time_picker_spec.js
spec/frontend/vue_shared/components/deprecated_modal_2_spec.js
spec/frontend/vue_shared/components/diff_viewer/diff_viewer_spec.js
spec/frontend/vue_shared/components/diff_viewer/viewers/image_diff_viewer_spec.js
spec/frontend/vue_shared/components/dismissible_container_spec.js
spec/frontend/vue_shared/components/editor_lite_spec.js
spec/frontend/vue_shared/components/expand_button_spec.js
spec/frontend/vue_shared/components/file_finder/index_spec.js
spec/frontend/vue_shared/components/file_finder/item_spec.js
spec/frontend/vue_shared/components/file_tree_spec.js
spec/frontend/vue_shared/components/filtered_search_bar/filtered_search_bar_root_spec.js
spec/frontend/vue_shared/components/filtered_search_bar/store/modules/filters/test_helper.js
spec/frontend/vue_shared/components/gl_countdown_spec.js
spec/frontend/vue_shared/components/gl_modal_vuex_spec.js
spec/frontend/vue_shared/components/issuable/issuable_header_warnings_spec.js
spec/frontend/vue_shared/components/issue/issue_assignees_spec.js
spec/frontend/vue_shared/components/issue/issue_milestone_spec.js
spec/frontend/vue_shared/components/local_storage_sync_spec.js
spec/frontend/vue_shared/components/markdown/apply_suggestion_spec.js
spec/frontend/vue_shared/components/markdown/header_spec.js
spec/frontend/vue_shared/components/markdown/suggestions_spec.js
spec/frontend/vue_shared/components/markdown/toolbar_button_spec.js
spec/frontend/vue_shared/components/notes/noteable_warning_spec.js
spec/frontend/vue_shared/components/ordered_layout_spec.js
spec/frontend/vue_shared/components/pagination_links_spec.js
spec/frontend/vue_shared/components/project_avatar/default_spec.js
spec/frontend/vue_shared/components/registry/details_row_spec.js
spec/frontend/vue_shared/components/registry/list_item_spec.js
spec/frontend/vue_shared/components/registry/metadata_item_spec.js
spec/frontend/vue_shared/components/registry/title_area_spec.js
## wizardly-agnesi ## wizardly-agnesi
spec/frontend/vue_shared/components/rich_content_editor/editor_service_spec.js spec/frontend/vue_shared/components/rich_content_editor/editor_service_spec.js
spec/frontend/vue_shared/components/rich_content_editor/modals/add_image/upload_image_tab_spec.js spec/frontend/vue_shared/components/rich_content_editor/modals/add_image/upload_image_tab_spec.js
......
...@@ -9,7 +9,7 @@ describe('MarkdownViewer', () => { ...@@ -9,7 +9,7 @@ describe('MarkdownViewer', () => {
let wrapper; let wrapper;
let mock; let mock;
const createComponent = props => { const createComponent = (props) => {
wrapper = mount(MarkdownViewer, { wrapper = mount(MarkdownViewer, {
propsData: { propsData: {
...props, ...props,
......
...@@ -71,7 +71,7 @@ describe('date time picker lib', () => { ...@@ -71,7 +71,7 @@ describe('date time picker lib', () => {
'2019-19-23', '2019-19-23',
'2019-09-23 x', '2019-09-23 x',
'2019-09-29 24:24:24', '2019-09-29 24:24:24',
].forEach(input => { ].forEach((input) => {
it(`throws error for invalid input like ${input}`, () => { it(`throws error for invalid input like ${input}`, () => {
expect(() => inputStringToIsoDate(input)).toThrow(); expect(() => inputStringToIsoDate(input)).toThrow();
}); });
......
...@@ -17,7 +17,7 @@ describe('DateTimePicker', () => { ...@@ -17,7 +17,7 @@ describe('DateTimePicker', () => {
const applyButtonElement = () => wrapper.find('button.btn-success').element; const applyButtonElement = () => wrapper.find('button.btn-success').element;
const findQuickRangeItems = () => wrapper.findAll('.dropdown-item'); const findQuickRangeItems = () => wrapper.findAll('.dropdown-item');
const createComponent = props => { const createComponent = (props) => {
wrapper = mount(DateTimePicker, { wrapper = mount(DateTimePicker, {
propsData: { propsData: {
...props, ...props,
...@@ -235,7 +235,7 @@ describe('DateTimePicker', () => { ...@@ -235,7 +235,7 @@ describe('DateTimePicker', () => {
it('unchecks quick range when text is input is clicked', () => { it('unchecks quick range when text is input is clicked', () => {
const findActiveItems = () => const findActiveItems = () =>
findQuickRangeItems().filter(w => w.classes().includes('active')); findQuickRangeItems().filter((w) => w.classes().includes('active'));
expect(findActiveItems().length).toBe(1); expect(findActiveItems().length).toBe(1);
......
...@@ -156,12 +156,12 @@ describe('DeprecatedModal2', () => { ...@@ -156,12 +156,12 @@ describe('DeprecatedModal2', () => {
describe('slots', () => { describe('slots', () => {
const slotContent = 'this should go into the slot'; const slotContent = 'this should go into the slot';
const modalWithSlot = slot => { const modalWithSlot = (slot) => {
return Vue.extend({ return Vue.extend({
components: { components: {
DeprecatedModal2, DeprecatedModal2,
}, },
render: h => render: (h) =>
h('deprecated-modal-2', [slot ? h('template', { slot }, slotContent) : slotContent]), h('deprecated-modal-2', [slot ? h('template', { slot }, slotContent) : slotContent]),
}); });
}; };
......
...@@ -26,7 +26,7 @@ describe('DiffViewer', () => { ...@@ -26,7 +26,7 @@ describe('DiffViewer', () => {
vm.$destroy(); vm.$destroy();
}); });
it('renders image diff', done => { it('renders image diff', (done) => {
window.gon = { window.gon = {
relative_url_root: '', relative_url_root: '',
}; };
...@@ -46,7 +46,7 @@ describe('DiffViewer', () => { ...@@ -46,7 +46,7 @@ describe('DiffViewer', () => {
}); });
}); });
it('renders fallback download diff display', done => { it('renders fallback download diff display', (done) => {
createComponent({ createComponent({
...requiredProps, ...requiredProps,
diffViewerMode: 'added', diffViewerMode: 'added',
......
...@@ -51,7 +51,7 @@ describe('ImageDiffViewer', () => { ...@@ -51,7 +51,7 @@ describe('ImageDiffViewer', () => {
wrapper.destroy(); wrapper.destroy();
}); });
it('renders image diff for replaced', done => { it('renders image diff for replaced', (done) => {
createComponent({ ...allProps }); createComponent({ ...allProps });
vm.$nextTick(() => { vm.$nextTick(() => {
...@@ -78,7 +78,7 @@ describe('ImageDiffViewer', () => { ...@@ -78,7 +78,7 @@ describe('ImageDiffViewer', () => {
}); });
}); });
it('renders image diff for new', done => { it('renders image diff for new', (done) => {
createComponent({ ...allProps, diffMode: 'new', oldPath: '' }); createComponent({ ...allProps, diffMode: 'new', oldPath: '' });
setImmediate(() => { setImmediate(() => {
...@@ -91,7 +91,7 @@ describe('ImageDiffViewer', () => { ...@@ -91,7 +91,7 @@ describe('ImageDiffViewer', () => {
}); });
}); });
it('renders image diff for deleted', done => { it('renders image diff for deleted', (done) => {
createComponent({ ...allProps, diffMode: 'deleted', newPath: '' }); createComponent({ ...allProps, diffMode: 'deleted', newPath: '' });
setImmediate(() => { setImmediate(() => {
...@@ -104,7 +104,7 @@ describe('ImageDiffViewer', () => { ...@@ -104,7 +104,7 @@ describe('ImageDiffViewer', () => {
}); });
}); });
it('renders image diff for renamed', done => { it('renders image diff for renamed', (done) => {
vm = new Vue({ vm = new Vue({
components: { components: {
imageDiffViewer, imageDiffViewer,
...@@ -139,7 +139,7 @@ describe('ImageDiffViewer', () => { ...@@ -139,7 +139,7 @@ describe('ImageDiffViewer', () => {
}); });
describe('swipeMode', () => { describe('swipeMode', () => {
beforeEach(done => { beforeEach((done) => {
createComponent({ ...requiredProps }); createComponent({ ...requiredProps });
setImmediate(() => { setImmediate(() => {
...@@ -147,7 +147,7 @@ describe('ImageDiffViewer', () => { ...@@ -147,7 +147,7 @@ describe('ImageDiffViewer', () => {
}); });
}); });
it('switches to Swipe Mode', done => { it('switches to Swipe Mode', (done) => {
vm.$el.querySelector('.view-modes-menu li:nth-child(2)').click(); vm.$el.querySelector('.view-modes-menu li:nth-child(2)').click();
vm.$nextTick(() => { vm.$nextTick(() => {
...@@ -158,7 +158,7 @@ describe('ImageDiffViewer', () => { ...@@ -158,7 +158,7 @@ describe('ImageDiffViewer', () => {
}); });
describe('onionSkin', () => { describe('onionSkin', () => {
beforeEach(done => { beforeEach((done) => {
createComponent({ ...requiredProps }); createComponent({ ...requiredProps });
setImmediate(() => { setImmediate(() => {
...@@ -166,7 +166,7 @@ describe('ImageDiffViewer', () => { ...@@ -166,7 +166,7 @@ describe('ImageDiffViewer', () => {
}); });
}); });
it('switches to Onion Skin Mode', done => { it('switches to Onion Skin Mode', (done) => {
vm.$el.querySelector('.view-modes-menu li:nth-child(3)').click(); vm.$el.querySelector('.view-modes-menu li:nth-child(3)').click();
vm.$nextTick(() => { vm.$nextTick(() => {
...@@ -177,7 +177,7 @@ describe('ImageDiffViewer', () => { ...@@ -177,7 +177,7 @@ describe('ImageDiffViewer', () => {
}); });
}); });
it('has working drag handler', done => { it('has working drag handler', (done) => {
vm.$el.querySelector('.view-modes-menu li:nth-child(3)').click(); vm.$el.querySelector('.view-modes-menu li:nth-child(3)').click();
vm.$nextTick(() => { vm.$nextTick(() => {
......
...@@ -43,7 +43,7 @@ describe('DismissibleContainer', () => { ...@@ -43,7 +43,7 @@ describe('DismissibleContainer', () => {
default: 'default slot', default: 'default slot',
}; };
it.each(Object.keys(slots))('renders the %s slot', slot => { it.each(Object.keys(slots))('renders the %s slot', (slot) => {
const slotContent = slots[slot]; const slotContent = slots[slot];
wrapper = shallowMount(dismissibleContainer, { wrapper = shallowMount(dismissibleContainer, {
propsData, propsData,
......
...@@ -47,7 +47,7 @@ describe('Editor Lite component', () => { ...@@ -47,7 +47,7 @@ describe('Editor Lite component', () => {
wrapper.destroy(); wrapper.destroy();
}); });
const triggerChangeContent = val => { const triggerChangeContent = (val) => {
mockInstance.getValue.mockReturnValue(val); mockInstance.getValue.mockReturnValue(val);
const [cb] = mockInstance.onDidChangeModelContent.mock.calls[0]; const [cb] = mockInstance.onDidChangeModelContent.mock.calls[0];
......
...@@ -66,7 +66,7 @@ describe('Expand button', () => { ...@@ -66,7 +66,7 @@ describe('Expand button', () => {
}); });
describe('on click', () => { describe('on click', () => {
beforeEach(done => { beforeEach((done) => {
expanderPrependEl().trigger('click'); expanderPrependEl().trigger('click');
Vue.nextTick(done); Vue.nextTick(done);
}); });
...@@ -85,7 +85,7 @@ describe('Expand button', () => { ...@@ -85,7 +85,7 @@ describe('Expand button', () => {
}); });
describe('when short text is provided', () => { describe('when short text is provided', () => {
beforeEach(done => { beforeEach((done) => {
factory({ factory({
slots: { slots: {
expanded: `<p>${text.expanded}</p>`, expanded: `<p>${text.expanded}</p>`,
...@@ -110,7 +110,7 @@ describe('Expand button', () => { ...@@ -110,7 +110,7 @@ describe('Expand button', () => {
}); });
describe('append button', () => { describe('append button', () => {
beforeEach(done => { beforeEach((done) => {
expanderPrependEl().trigger('click'); expanderPrependEl().trigger('click');
Vue.nextTick(done); Vue.nextTick(done);
}); });
...@@ -134,7 +134,7 @@ describe('Expand button', () => { ...@@ -134,7 +134,7 @@ describe('Expand button', () => {
}); });
describe('when short text is provided', () => { describe('when short text is provided', () => {
beforeEach(done => { beforeEach((done) => {
factory({ factory({
slots: { slots: {
expanded: `<p>${text.expanded}</p>`, expanded: `<p>${text.expanded}</p>`,
......
...@@ -31,7 +31,7 @@ describe('File finder item spec', () => { ...@@ -31,7 +31,7 @@ describe('File finder item spec', () => {
}); });
describe('with entries', () => { describe('with entries', () => {
beforeEach(done => { beforeEach((done) => {
createComponent({ createComponent({
files: [ files: [
{ {
...@@ -57,7 +57,7 @@ describe('File finder item spec', () => { ...@@ -57,7 +57,7 @@ describe('File finder item spec', () => {
expect(vm.$el.textContent).not.toContain('folder'); expect(vm.$el.textContent).not.toContain('folder');
}); });
it('filters entries', done => { it('filters entries', (done) => {
vm.searchText = 'index'; vm.searchText = 'index';
setImmediate(() => { setImmediate(() => {
...@@ -68,7 +68,7 @@ describe('File finder item spec', () => { ...@@ -68,7 +68,7 @@ describe('File finder item spec', () => {
}); });
}); });
it('shows clear button when searchText is not empty', done => { it('shows clear button when searchText is not empty', (done) => {
vm.searchText = 'index'; vm.searchText = 'index';
setImmediate(() => { setImmediate(() => {
...@@ -79,7 +79,7 @@ describe('File finder item spec', () => { ...@@ -79,7 +79,7 @@ describe('File finder item spec', () => {
}); });
}); });
it('clear button resets searchText', done => { it('clear button resets searchText', (done) => {
vm.searchText = 'index'; vm.searchText = 'index';
waitForPromises() waitForPromises()
...@@ -94,7 +94,7 @@ describe('File finder item spec', () => { ...@@ -94,7 +94,7 @@ describe('File finder item spec', () => {
.catch(done.fail); .catch(done.fail);
}); });
it('clear button focuses search input', done => { it('clear button focuses search input', (done) => {
jest.spyOn(vm.$refs.searchInput, 'focus').mockImplementation(() => {}); jest.spyOn(vm.$refs.searchInput, 'focus').mockImplementation(() => {});
vm.searchText = 'index'; vm.searchText = 'index';
...@@ -111,7 +111,7 @@ describe('File finder item spec', () => { ...@@ -111,7 +111,7 @@ describe('File finder item spec', () => {
}); });
describe('listShowCount', () => { describe('listShowCount', () => {
it('returns 1 when no filtered entries exist', done => { it('returns 1 when no filtered entries exist', (done) => {
vm.searchText = 'testing 123'; vm.searchText = 'testing 123';
setImmediate(() => { setImmediate(() => {
...@@ -131,7 +131,7 @@ describe('File finder item spec', () => { ...@@ -131,7 +131,7 @@ describe('File finder item spec', () => {
expect(vm.listHeight).toBe(55); expect(vm.listHeight).toBe(55);
}); });
it('returns 33 when entries dont exist', done => { it('returns 33 when entries dont exist', (done) => {
vm.searchText = 'testing 123'; vm.searchText = 'testing 123';
setImmediate(() => { setImmediate(() => {
...@@ -143,7 +143,7 @@ describe('File finder item spec', () => { ...@@ -143,7 +143,7 @@ describe('File finder item spec', () => {
}); });
describe('filteredBlobsLength', () => { describe('filteredBlobsLength', () => {
it('returns length of filtered blobs', done => { it('returns length of filtered blobs', (done) => {
vm.searchText = 'index'; vm.searchText = 'index';
setImmediate(() => { setImmediate(() => {
...@@ -156,7 +156,7 @@ describe('File finder item spec', () => { ...@@ -156,7 +156,7 @@ describe('File finder item spec', () => {
describe('watches', () => { describe('watches', () => {
describe('searchText', () => { describe('searchText', () => {
it('resets focusedIndex when updated', done => { it('resets focusedIndex when updated', (done) => {
vm.focusedIndex = 1; vm.focusedIndex = 1;
vm.searchText = 'test'; vm.searchText = 'test';
...@@ -169,7 +169,7 @@ describe('File finder item spec', () => { ...@@ -169,7 +169,7 @@ describe('File finder item spec', () => {
}); });
describe('visible', () => { describe('visible', () => {
it('returns searchText when false', done => { it('returns searchText when false', (done) => {
vm.searchText = 'test'; vm.searchText = 'test';
vm.visible = true; vm.visible = true;
...@@ -206,7 +206,7 @@ describe('File finder item spec', () => { ...@@ -206,7 +206,7 @@ describe('File finder item spec', () => {
}); });
describe('onKeyup', () => { describe('onKeyup', () => {
it('opens file on enter key', done => { it('opens file on enter key', (done) => {
const event = new CustomEvent('keyup'); const event = new CustomEvent('keyup');
event.keyCode = ENTER_KEY_CODE; event.keyCode = ENTER_KEY_CODE;
...@@ -221,7 +221,7 @@ describe('File finder item spec', () => { ...@@ -221,7 +221,7 @@ describe('File finder item spec', () => {
}); });
}); });
it('closes file finder on esc key', done => { it('closes file finder on esc key', (done) => {
const event = new CustomEvent('keyup'); const event = new CustomEvent('keyup');
event.keyCode = ESC_KEY_CODE; event.keyCode = ESC_KEY_CODE;
...@@ -300,7 +300,7 @@ describe('File finder item spec', () => { ...@@ -300,7 +300,7 @@ describe('File finder item spec', () => {
}); });
describe('keyboard shortcuts', () => { describe('keyboard shortcuts', () => {
beforeEach(done => { beforeEach((done) => {
createComponent(); createComponent();
jest.spyOn(vm, 'toggle').mockImplementation(() => {}); jest.spyOn(vm, 'toggle').mockImplementation(() => {});
...@@ -308,7 +308,7 @@ describe('File finder item spec', () => { ...@@ -308,7 +308,7 @@ describe('File finder item spec', () => {
vm.$nextTick(done); vm.$nextTick(done);
}); });
it('calls toggle on `t` key press', done => { it('calls toggle on `t` key press', (done) => {
Mousetrap.trigger('t'); Mousetrap.trigger('t');
vm.$nextTick() vm.$nextTick()
...@@ -319,7 +319,7 @@ describe('File finder item spec', () => { ...@@ -319,7 +319,7 @@ describe('File finder item spec', () => {
.catch(done.fail); .catch(done.fail);
}); });
it('calls toggle on `mod+p` key press', done => { it('calls toggle on `mod+p` key press', (done) => {
Mousetrap.trigger('mod+p'); Mousetrap.trigger('mod+p');
vm.$nextTick() vm.$nextTick()
......
...@@ -37,7 +37,7 @@ describe('File finder item spec', () => { ...@@ -37,7 +37,7 @@ describe('File finder item spec', () => {
expect(vm.$el.classList).toContain('is-focused'); expect(vm.$el.classList).toContain('is-focused');
}); });
it('does not have is-focused class when not focused', done => { it('does not have is-focused class when not focused', (done) => {
vm.focused = false; vm.focused = false;
vm.$nextTick(() => { vm.$nextTick(() => {
...@@ -53,7 +53,7 @@ describe('File finder item spec', () => { ...@@ -53,7 +53,7 @@ describe('File finder item spec', () => {
expect(vm.$el.querySelector('.diff-changed-stats')).toBe(null); expect(vm.$el.querySelector('.diff-changed-stats')).toBe(null);
}); });
it('renders when a changed file', done => { it('renders when a changed file', (done) => {
vm.file.changed = true; vm.file.changed = true;
vm.$nextTick(() => { vm.$nextTick(() => {
...@@ -63,7 +63,7 @@ describe('File finder item spec', () => { ...@@ -63,7 +63,7 @@ describe('File finder item spec', () => {
}); });
}); });
it('renders when a temp file', done => { it('renders when a temp file', (done) => {
vm.file.tempFile = true; vm.file.tempFile = true;
vm.$nextTick(() => { vm.$nextTick(() => {
...@@ -85,7 +85,7 @@ describe('File finder item spec', () => { ...@@ -85,7 +85,7 @@ describe('File finder item spec', () => {
describe('path', () => { describe('path', () => {
let el; let el;
beforeEach(done => { beforeEach((done) => {
vm.searchText = 'file'; vm.searchText = 'file';
el = vm.$el.querySelector('.diff-changed-file-path'); el = vm.$el.querySelector('.diff-changed-file-path');
...@@ -97,7 +97,7 @@ describe('File finder item spec', () => { ...@@ -97,7 +97,7 @@ describe('File finder item spec', () => {
expect(el.querySelectorAll('.highlighted').length).toBe(4); expect(el.querySelectorAll('.highlighted').length).toBe(4);
}); });
it('adds ellipsis to long text', done => { it('adds ellipsis to long text', (done) => {
vm.file.path = new Array(70) vm.file.path = new Array(70)
.fill() .fill()
.map((_, i) => `${i}-`) .map((_, i) => `${i}-`)
...@@ -113,7 +113,7 @@ describe('File finder item spec', () => { ...@@ -113,7 +113,7 @@ describe('File finder item spec', () => {
describe('name', () => { describe('name', () => {
let el; let el;
beforeEach(done => { beforeEach((done) => {
vm.searchText = 'file'; vm.searchText = 'file';
el = vm.$el.querySelector('.diff-changed-file-name'); el = vm.$el.querySelector('.diff-changed-file-name');
...@@ -125,7 +125,7 @@ describe('File finder item spec', () => { ...@@ -125,7 +125,7 @@ describe('File finder item spec', () => {
expect(el.querySelectorAll('.highlighted').length).toBe(4); expect(el.querySelectorAll('.highlighted').length).toBe(4);
}); });
it('does not add ellipsis to long text', done => { it('does not add ellipsis to long text', (done) => {
vm.file.name = new Array(70) vm.file.name = new Array(70)
.fill() .fill()
.map((_, i) => `${i}-`) .map((_, i) => `${i}-`)
......
...@@ -28,7 +28,7 @@ describe('File Tree component', () => { ...@@ -28,7 +28,7 @@ describe('File Tree component', () => {
const findFileRow = () => wrapper.find(MockFileRow); const findFileRow = () => wrapper.find(MockFileRow);
const findChildrenTrees = () => wrapper.findAll(FileTree).wrappers.slice(1); const findChildrenTrees = () => wrapper.findAll(FileTree).wrappers.slice(1);
const findChildrenTreeProps = () => const findChildrenTreeProps = () =>
findChildrenTrees().map(x => ({ findChildrenTrees().map((x) => ({
...x.props(), ...x.props(),
...pick(x.attributes(), Object.keys(TEST_EXTA_ARGS)), ...pick(x.attributes(), Object.keys(TEST_EXTA_ARGS)),
})); }));
...@@ -61,7 +61,7 @@ describe('File Tree component', () => { ...@@ -61,7 +61,7 @@ describe('File Tree component', () => {
describe('file tree', () => { describe('file tree', () => {
const createChildren = () => [{ id: 1 }, { id: 2 }]; const createChildren = () => [{ id: 1 }, { id: 2 }];
const createChildrenExpectation = (props = {}) => const createChildrenExpectation = (props = {}) =>
createChildren().map(file => ({ createChildren().map((file) => ({
fileRowComponent: MockFileRow, fileRowComponent: MockFileRow,
file, file,
...TEST_EXTA_ARGS, ...TEST_EXTA_ARGS,
......
...@@ -28,7 +28,7 @@ import { ...@@ -28,7 +28,7 @@ import {
} from './mock_data'; } from './mock_data';
jest.mock('~/vue_shared/components/filtered_search_bar/filtered_search_utils', () => ({ jest.mock('~/vue_shared/components/filtered_search_bar/filtered_search_utils', () => ({
uniqueTokens: jest.fn().mockImplementation(tokens => tokens), uniqueTokens: jest.fn().mockImplementation((tokens) => tokens),
stripQuotes: jest.requireActual( stripQuotes: jest.requireActual(
'~/vue_shared/components/filtered_search_bar/filtered_search_utils', '~/vue_shared/components/filtered_search_bar/filtered_search_utils',
).stripQuotes, ).stripQuotes,
......
export function getFilterParams(tokens, options = {}) { export function getFilterParams(tokens, options = {}) {
const { key = 'value', operator = '=', prop = 'title' } = options; const { key = 'value', operator = '=', prop = 'title' } = options;
return tokens.map(token => { return tokens.map((token) => {
return { [key]: token[prop], operator }; return { [key]: token[prop], operator };
}); });
} }
export function getFilterValues(tokens, options = {}) { export function getFilterValues(tokens, options = {}) {
const { prop = 'title' } = options; const { prop = 'title' } = options;
return tokens.map(token => token[prop]); return tokens.map((token) => token[prop]);
} }
...@@ -17,7 +17,7 @@ describe('GlCountdown', () => { ...@@ -17,7 +17,7 @@ describe('GlCountdown', () => {
}); });
describe('when there is time remaining', () => { describe('when there is time remaining', () => {
beforeEach(done => { beforeEach((done) => {
vm = mountComponent(Component, { vm = mountComponent(Component, {
endDateString: '2000-01-01T01:02:03Z', endDateString: '2000-01-01T01:02:03Z',
}); });
...@@ -29,7 +29,7 @@ describe('GlCountdown', () => { ...@@ -29,7 +29,7 @@ describe('GlCountdown', () => {
expect(vm.$el.textContent).toContain('01:02:03'); expect(vm.$el.textContent).toContain('01:02:03');
}); });
it('updates remaining time', done => { it('updates remaining time', (done) => {
now = '2000-01-01T00:00:01Z'; now = '2000-01-01T00:00:01Z';
jest.advanceTimersByTime(1000); jest.advanceTimersByTime(1000);
...@@ -43,7 +43,7 @@ describe('GlCountdown', () => { ...@@ -43,7 +43,7 @@ describe('GlCountdown', () => {
}); });
describe('when there is no time remaining', () => { describe('when there is no time remaining', () => {
beforeEach(done => { beforeEach((done) => {
vm = mountComponent(Component, { vm = mountComponent(Component, {
endDateString: '1900-01-01T00:00:00Z', endDateString: '1900-01-01T00:00:00Z',
}); });
......
...@@ -118,7 +118,7 @@ describe('GlModalVuex', () => { ...@@ -118,7 +118,7 @@ describe('GlModalVuex', () => {
expect(actions.hide).toHaveBeenCalledTimes(1); expect(actions.hide).toHaveBeenCalledTimes(1);
}); });
it('calls bootstrap show when isVisible changes', done => { it('calls bootstrap show when isVisible changes', (done) => {
state.isVisible = false; state.isVisible = false;
factory(); factory();
...@@ -135,7 +135,7 @@ describe('GlModalVuex', () => { ...@@ -135,7 +135,7 @@ describe('GlModalVuex', () => {
.catch(done.fail); .catch(done.fail);
}); });
it('calls bootstrap hide when isVisible changes', done => { it('calls bootstrap hide when isVisible changes', (done) => {
state.isVisible = true; state.isVisible = true;
factory(); factory();
...@@ -154,7 +154,7 @@ describe('GlModalVuex', () => { ...@@ -154,7 +154,7 @@ describe('GlModalVuex', () => {
it.each(['ok', 'cancel'])( it.each(['ok', 'cancel'])(
'passes an "%s" handler to the "modal-footer" slot scope', 'passes an "%s" handler to the "modal-footer" slot scope',
handlerName => { (handlerName) => {
state.isVisible = true; state.isVisible = true;
const modalFooterSlotContent = jest.fn(); const modalFooterSlotContent = jest.fn();
......
...@@ -17,13 +17,13 @@ describe('IssuableHeaderWarnings', () => { ...@@ -17,13 +17,13 @@ describe('IssuableHeaderWarnings', () => {
const findConfidentialIcon = () => wrapper.find('[data-testid="confidential"]'); const findConfidentialIcon = () => wrapper.find('[data-testid="confidential"]');
const findLockedIcon = () => wrapper.find('[data-testid="locked"]'); const findLockedIcon = () => wrapper.find('[data-testid="locked"]');
const renderTestMessage = renders => (renders ? 'renders' : 'does not render'); const renderTestMessage = (renders) => (renders ? 'renders' : 'does not render');
const setLock = locked => { const setLock = (locked) => {
store.getters.getNoteableData.discussion_locked = locked; store.getters.getNoteableData.discussion_locked = locked;
}; };
const setConfidential = confidential => { const setConfidential = (confidential) => {
store.getters.getNoteableData.confidential = confidential; store.getters.getNoteableData.confidential = confidential;
}; };
......
...@@ -11,7 +11,7 @@ describe('IssueAssigneesComponent', () => { ...@@ -11,7 +11,7 @@ describe('IssueAssigneesComponent', () => {
let wrapper; let wrapper;
let vm; let vm;
const factory = props => { const factory = (props) => {
wrapper = shallowMount(IssueAssignees, { wrapper = shallowMount(IssueAssignees, {
propsData: { propsData: {
assignees: mockAssigneesList, assignees: mockAssigneesList,
...@@ -99,11 +99,11 @@ describe('IssueAssigneesComponent', () => { ...@@ -99,11 +99,11 @@ describe('IssueAssigneesComponent', () => {
}); });
it('renders assignee', () => { it('renders assignee', () => {
const data = findAvatars().wrappers.map(x => ({ const data = findAvatars().wrappers.map((x) => ({
...x.props(), ...x.props(),
})); }));
const expected = mockAssigneesList.slice(0, TEST_MAX_VISIBLE - 1).map(x => const expected = mockAssigneesList.slice(0, TEST_MAX_VISIBLE - 1).map((x) =>
expect.objectContaining({ expect.objectContaining({
linkHref: x.web_url, linkHref: x.web_url,
imgAlt: `Avatar for ${x.name}`, imgAlt: `Avatar for ${x.name}`,
......
...@@ -19,7 +19,7 @@ describe('IssueMilestoneComponent', () => { ...@@ -19,7 +19,7 @@ describe('IssueMilestoneComponent', () => {
let wrapper; let wrapper;
let vm; let vm;
beforeEach(done => { beforeEach((done) => {
wrapper = createComponent(); wrapper = createComponent();
({ vm } = wrapper); ({ vm } = wrapper);
......
...@@ -49,7 +49,7 @@ describe('Local Storage Sync', () => { ...@@ -49,7 +49,7 @@ describe('Local Storage Sync', () => {
it.each('foo', 3, true, ['foo', 'bar'], { foo: 'bar' })( it.each('foo', 3, true, ['foo', 'bar'], { foo: 'bar' })(
'saves updated value to localStorage', 'saves updated value to localStorage',
newValue => { (newValue) => {
createComponent({ createComponent({
props: { props: {
storageKey, storageKey,
......
...@@ -6,7 +6,7 @@ describe('Apply Suggestion component', () => { ...@@ -6,7 +6,7 @@ describe('Apply Suggestion component', () => {
const propsData = { fileName: 'test.js', disabled: false }; const propsData = { fileName: 'test.js', disabled: false };
let wrapper; let wrapper;
const createWrapper = props => { const createWrapper = (props) => {
wrapper = shallowMount(ApplySuggestionComponent, { propsData: { ...propsData, ...props } }); wrapper = shallowMount(ApplySuggestionComponent, { propsData: { ...propsData, ...props } });
}; };
......
...@@ -6,7 +6,7 @@ import ToolbarButton from '~/vue_shared/components/markdown/toolbar_button.vue'; ...@@ -6,7 +6,7 @@ import ToolbarButton from '~/vue_shared/components/markdown/toolbar_button.vue';
describe('Markdown field header component', () => { describe('Markdown field header component', () => {
let wrapper; let wrapper;
const createWrapper = props => { const createWrapper = (props) => {
wrapper = shallowMount(HeaderComponent, { wrapper = shallowMount(HeaderComponent, {
propsData: { propsData: {
previewMarkdown: false, previewMarkdown: false,
...@@ -18,7 +18,7 @@ describe('Markdown field header component', () => { ...@@ -18,7 +18,7 @@ describe('Markdown field header component', () => {
const findToolbarButtons = () => wrapper.findAll(ToolbarButton); const findToolbarButtons = () => wrapper.findAll(ToolbarButton);
const findToolbarButtonByProp = (prop, value) => const findToolbarButtonByProp = (prop, value) =>
findToolbarButtons() findToolbarButtons()
.filter(button => button.props(prop) === value) .filter((button) => button.props(prop) === value)
.at(0); .at(0);
beforeEach(() => { beforeEach(() => {
......
...@@ -50,7 +50,7 @@ describe('Suggestion component', () => { ...@@ -50,7 +50,7 @@ describe('Suggestion component', () => {
let vm; let vm;
let diffTable; let diffTable;
beforeEach(done => { beforeEach((done) => {
const Component = Vue.extend(SuggestionsComponent); const Component = Vue.extend(SuggestionsComponent);
vm = new Component({ vm = new Component({
...@@ -86,7 +86,7 @@ describe('Suggestion component', () => { ...@@ -86,7 +86,7 @@ describe('Suggestion component', () => {
}); });
it('generates a diff table that contains contents the suggested lines', () => { it('generates a diff table that contains contents the suggested lines', () => {
MOCK_DATA.suggestions[0].diff_lines.forEach(line => { MOCK_DATA.suggestions[0].diff_lines.forEach((line) => {
const text = line.text.substring(1); const text = line.text.substring(1);
expect(diffTable.innerHTML.includes(text)).toBe(true); expect(diffTable.innerHTML.includes(text)).toBe(true);
......
...@@ -10,7 +10,7 @@ describe('toolbar_button', () => { ...@@ -10,7 +10,7 @@ describe('toolbar_button', () => {
tag: 'test tag', tag: 'test tag',
}; };
const createComponent = propUpdates => { const createComponent = (propUpdates) => {
wrapper = shallowMount(ToolbarButton, { wrapper = shallowMount(ToolbarButton, {
propsData: { propsData: {
...defaultProps, ...defaultProps,
......
...@@ -10,7 +10,7 @@ describe('Issue Warning Component', () => { ...@@ -10,7 +10,7 @@ describe('Issue Warning Component', () => {
const findConfidentialBlock = (w = wrapper) => w.find({ ref: 'confidential' }); const findConfidentialBlock = (w = wrapper) => w.find({ ref: 'confidential' });
const findLockedAndConfidentialBlock = (w = wrapper) => w.find({ ref: 'lockedAndConfidential' }); const findLockedAndConfidentialBlock = (w = wrapper) => w.find({ ref: 'lockedAndConfidential' });
const createComponent = props => const createComponent = (props) =>
shallowMount(NoteableWarning, { shallowMount(NoteableWarning, {
propsData: { propsData: {
...props, ...props,
......
...@@ -29,7 +29,7 @@ describe('Ordered Layout', () => { ...@@ -29,7 +29,7 @@ describe('Ordered Layout', () => {
const verifyOrder = () => const verifyOrder = () =>
wrapper wrapper
.findAll('footer,header') .findAll('footer,header')
.wrappers.map(x => (x.element.tagName === 'FOOTER' ? 'footer' : 'header')); .wrappers.map((x) => (x.element.tagName === 'FOOTER' ? 'footer' : 'header'));
const createComponent = (props = {}) => { const createComponent = (props = {}) => {
wrapper = mount(TestComponent, { wrapper = mount(TestComponent, {
......
...@@ -49,7 +49,7 @@ describe('Pagination links component', () => { ...@@ -49,7 +49,7 @@ describe('Pagination links component', () => {
}); });
it('should provide translated text to GitLab UI pagination', () => { it('should provide translated text to GitLab UI pagination', () => {
Object.entries(translations).forEach(entry => { Object.entries(translations).forEach((entry) => {
expect(glPagination.vm[entry[0]]).toBe(entry[1]); expect(glPagination.vm[entry[0]]).toBe(entry[1]);
}); });
}); });
......
...@@ -19,7 +19,7 @@ describe('ProjectAvatarDefault component', () => { ...@@ -19,7 +19,7 @@ describe('ProjectAvatarDefault component', () => {
vm.$destroy(); vm.$destroy();
}); });
it('renders identicon if project has no avatar_url', done => { it('renders identicon if project has no avatar_url', (done) => {
const expectedText = getFirstCharacterCapitalized(projectData.name); const expectedText = getFirstCharacterCapitalized(projectData.name);
vm.project = { vm.project = {
...@@ -38,7 +38,7 @@ describe('ProjectAvatarDefault component', () => { ...@@ -38,7 +38,7 @@ describe('ProjectAvatarDefault component', () => {
.catch(done.fail); .catch(done.fail);
}); });
it('renders avatar image if project has avatar_url', done => { it('renders avatar image if project has avatar_url', (done) => {
const avatarUrl = `${TEST_HOST}/images/home/nasa.svg`; const avatarUrl = `${TEST_HOST}/images/home/nasa.svg`;
vm.project = { vm.project = {
......
...@@ -8,7 +8,7 @@ describe('DetailsRow', () => { ...@@ -8,7 +8,7 @@ describe('DetailsRow', () => {
const findIcon = () => wrapper.find(GlIcon); const findIcon = () => wrapper.find(GlIcon);
const findDefaultSlot = () => wrapper.find('[data-testid="default-slot"]'); const findDefaultSlot = () => wrapper.find('[data-testid="default-slot"]');
const mountComponent = props => { const mountComponent = (props) => {
wrapper = shallowMount(component, { wrapper = shallowMount(component, {
propsData: { propsData: {
icon: 'clock', icon: 'clock',
......
...@@ -11,7 +11,7 @@ describe('list item', () => { ...@@ -11,7 +11,7 @@ describe('list item', () => {
const findRightPrimarySlot = () => wrapper.find('[data-testid="right-primary"]'); const findRightPrimarySlot = () => wrapper.find('[data-testid="right-primary"]');
const findRightSecondarySlot = () => wrapper.find('[data-testid="right-secondary"]'); const findRightSecondarySlot = () => wrapper.find('[data-testid="right-secondary"]');
const findRightActionSlot = () => wrapper.find('[data-testid="right-action"]'); const findRightActionSlot = () => wrapper.find('[data-testid="right-action"]');
const findDetailsSlot = name => wrapper.find(`[data-testid="${name}"]`); const findDetailsSlot = (name) => wrapper.find(`[data-testid="${name}"]`);
const findToggleDetailsButton = () => wrapper.find(GlButton); const findToggleDetailsButton = () => wrapper.find(GlButton);
const mountComponent = (propsData, slots) => { const mountComponent = (propsData, slots) => {
...@@ -74,14 +74,14 @@ describe('list item', () => { ...@@ -74,14 +74,14 @@ describe('list item', () => {
findToggleDetailsButton().vm.$emit('click'); findToggleDetailsButton().vm.$emit('click');
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
slotNames.forEach(name => { slotNames.forEach((name) => {
expect(findDetailsSlot(name).exists()).toBe(true); expect(findDetailsSlot(name).exists()).toBe(true);
}); });
}); });
it('are not visible when details are not shown', () => { it('are not visible when details are not shown', () => {
mountComponent({}, slotMocks); mountComponent({}, slotMocks);
slotNames.forEach(name => { slotNames.forEach((name) => {
expect(findDetailsSlot(name).exists()).toBe(false); expect(findDetailsSlot(name).exists()).toBe(false);
}); });
}); });
......
...@@ -25,7 +25,7 @@ describe('Metadata Item', () => { ...@@ -25,7 +25,7 @@ describe('Metadata Item', () => {
const findText = () => wrapper.find('[data-testid="metadata-item-text"]'); const findText = () => wrapper.find('[data-testid="metadata-item-text"]');
const findTooltipOnTruncate = (w = wrapper) => w.find(TooltipOnTruncate); const findTooltipOnTruncate = (w = wrapper) => w.find(TooltipOnTruncate);
describe.each(['xs', 's', 'm', 'l', 'xl'])('size class', size => { describe.each(['xs', 's', 'm', 'l', 'xl'])('size class', (size) => {
const className = `mw-${size}`; const className = `mw-${size}`;
it(`${size} is assigned correctly to text`, () => { it(`${size} is assigned correctly to text`, () => {
......
...@@ -9,7 +9,7 @@ describe('title area', () => { ...@@ -9,7 +9,7 @@ describe('title area', () => {
const findSubHeaderSlot = () => wrapper.find('[data-testid="sub-header"]'); const findSubHeaderSlot = () => wrapper.find('[data-testid="sub-header"]');
const findRightActionsSlot = () => wrapper.find('[data-testid="right-actions"]'); const findRightActionsSlot = () => wrapper.find('[data-testid="right-actions"]');
const findMetadataSlot = name => wrapper.find(`[data-testid="${name}"]`); const findMetadataSlot = (name) => wrapper.find(`[data-testid="${name}"]`);
const findTitle = () => wrapper.find('[data-testid="title"]'); const findTitle = () => wrapper.find('[data-testid="title"]');
const findAvatar = () => wrapper.find(GlAvatar); const findAvatar = () => wrapper.find(GlAvatar);
const findInfoMessages = () => wrapper.findAll('[data-testid="info-message"]'); const findInfoMessages = () => wrapper.findAll('[data-testid="info-message"]');
...@@ -97,7 +97,7 @@ describe('title area', () => { ...@@ -97,7 +97,7 @@ describe('title area', () => {
mountComponent({ slots: slotMocks }); mountComponent({ slots: slotMocks });
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
slotNames.forEach(name => { slotNames.forEach((name) => {
expect(findMetadataSlot(name).exists()).toBe(true); expect(findMetadataSlot(name).exists()).toBe(true);
}); });
}); });
...@@ -106,7 +106,7 @@ describe('title area', () => { ...@@ -106,7 +106,7 @@ describe('title area', () => {
mountComponent({ slots: slotMocks, propsData: { title: 'foo', metadataLoading: true } }); mountComponent({ slots: slotMocks, propsData: { title: 'foo', metadataLoading: true } });
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
slotNames.forEach(name => { slotNames.forEach((name) => {
expect(findMetadataSlot(name).exists()).toBe(false); expect(findMetadataSlot(name).exists()).toBe(false);
}); });
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment