Commit 0fdc1fc0 authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 32 files - 56 of 73

Part of our prettier migration; changing the arrow-parens style.
parent 157e117f
...@@ -1706,40 +1706,6 @@ spec/frontend/behaviors/markdown/paste_markdown_table_spec.js ...@@ -1706,40 +1706,6 @@ spec/frontend/behaviors/markdown/paste_markdown_table_spec.js
spec/frontend/behaviors/quick_submit_spec.js spec/frontend/behaviors/quick_submit_spec.js
spec/frontend/behaviors/secret_values_spec.js spec/frontend/behaviors/secret_values_spec.js
## eloquent-black
spec/frontend/cycle_analytics/limit_warning_component_spec.js
spec/frontend/deploy_freeze/components/timezone_dropdown_spec.js
spec/frontend/deploy_keys/components/key_spec.js
spec/frontend/deploy_keys/components/keys_panel_spec.js
spec/frontend/deprecated_jquery_dropdown_spec.js
spec/frontend/design_management/components/design_notes/design_discussion_spec.js
spec/frontend/design_management/components/design_overlay_spec.js
spec/frontend/design_management/components/design_scaler_spec.js
spec/frontend/design_management/components/upload/design_version_dropdown_spec.js
spec/frontend/design_management/pages/index_spec.js
spec/frontend/design_management/router_spec.js
spec/frontend/design_management/utils/error_messages_spec.js
spec/frontend/diffs/components/app_spec.js
spec/frontend/diffs/components/compare_dropdown_layout_spec.js
spec/frontend/diffs/components/compare_versions_spec.js
spec/frontend/diffs/components/diff_content_spec.js
spec/frontend/diffs/components/diff_discussions_spec.js
spec/frontend/diffs/components/diff_expansion_cell_spec.js
spec/frontend/diffs/components/diff_file_spec.js
spec/frontend/diffs/components/diff_line_note_form_spec.js
spec/frontend/diffs/components/diff_stats_spec.js
spec/frontend/diffs/components/diff_view_spec.js
spec/frontend/diffs/components/image_diff_overlay_spec.js
spec/frontend/diffs/components/no_changes_spec.js
spec/frontend/diffs/components/parallel_diff_table_row_spec.js
spec/frontend/diffs/components/settings_dropdown_spec.js
spec/frontend/diffs/store/actions_spec.js
spec/frontend/diffs/store/getters_versions_dropdowns_spec.js
spec/frontend/diffs/store/utils_spec.js
spec/frontend/diffs/utils/uuids_spec.js
spec/frontend/dirty_submit/dirty_submit_collection_spec.js
spec/frontend/dirty_submit/dirty_submit_form_spec.js
## exciting-driscoll ## exciting-driscoll
spec/frontend/droplab/drop_down_spec.js spec/frontend/droplab/drop_down_spec.js
spec/frontend/droplab/plugins/ajax_filter_spec.js spec/frontend/droplab/plugins/ajax_filter_spec.js
......
...@@ -5,7 +5,7 @@ import LimitWarningComponent from '~/cycle_analytics/components/limit_warning_co ...@@ -5,7 +5,7 @@ import LimitWarningComponent from '~/cycle_analytics/components/limit_warning_co
Vue.use(Translate); Vue.use(Translate);
const createComponent = props => const createComponent = (props) =>
shallowMount(LimitWarningComponent, { shallowMount(LimitWarningComponent, {
propsData: { propsData: {
...props, ...props,
......
...@@ -30,7 +30,7 @@ describe('Deploy freeze timezone dropdown', () => { ...@@ -30,7 +30,7 @@ describe('Deploy freeze timezone dropdown', () => {
}; };
const findAllDropdownItems = () => wrapper.findAll(GlDropdownItem); const findAllDropdownItems = () => wrapper.findAll(GlDropdownItem);
const findDropdownItemByIndex = index => wrapper.findAll(GlDropdownItem).at(index); const findDropdownItemByIndex = (index) => wrapper.findAll(GlDropdownItem).at(index);
afterEach(() => { afterEach(() => {
wrapper.destroy(); wrapper.destroy();
......
...@@ -9,9 +9,9 @@ describe('Deploy keys key', () => { ...@@ -9,9 +9,9 @@ describe('Deploy keys key', () => {
const data = getJSONFixture('deploy_keys/keys.json'); const data = getJSONFixture('deploy_keys/keys.json');
const findTextAndTrim = selector => wrapper.find(selector).text().trim(); const findTextAndTrim = (selector) => wrapper.find(selector).text().trim();
const createComponent = propsData => { const createComponent = (propsData) => {
wrapper = mount(key, { wrapper = mount(key, {
propsData: { propsData: {
store, store,
......
...@@ -8,7 +8,7 @@ describe('Deploy keys panel', () => { ...@@ -8,7 +8,7 @@ describe('Deploy keys panel', () => {
const findTableRowHeader = () => wrapper.find('.table-row-header'); const findTableRowHeader = () => wrapper.find('.table-row-header');
const mountComponent = props => { const mountComponent = (props) => {
const store = new DeployKeysStore(); const store = new DeployKeysStore();
store.keys = data; store.keys = data;
wrapper = mount(deployKeysPanel, { wrapper = mount(deployKeysPanel, {
......
...@@ -56,8 +56,8 @@ describe('deprecatedJQueryDropdown', () => { ...@@ -56,8 +56,8 @@ describe('deprecatedJQueryDropdown', () => {
search: { search: {
fields: ['name'], fields: ['name'],
}, },
text: project => project.name_with_namespace || project.name, text: (project) => project.name_with_namespace || project.name,
id: project => project.id, id: (project) => project.id,
...extraOpts, ...extraOpts,
}; };
test.dropdownButtonElement = $('#js-project-dropdown', test.dropdownContainerElement); test.dropdownButtonElement = $('#js-project-dropdown', test.dropdownContainerElement);
......
...@@ -108,7 +108,7 @@ describe('Design discussions component', () => { ...@@ -108,7 +108,7 @@ describe('Design discussions component', () => {
it('renders correct amount of discussion notes', () => { it('renders correct amount of discussion notes', () => {
expect(findDesignNotes()).toHaveLength(2); expect(findDesignNotes()).toHaveLength(2);
expect(findDesignNotes().wrappers.every(w => w.isVisible())).toBe(true); expect(findDesignNotes().wrappers.every((w) => w.isVisible())).toBe(true);
}); });
it('renders reply placeholder', () => { it('renders reply placeholder', () => {
...@@ -251,7 +251,7 @@ describe('Design discussions component', () => { ...@@ -251,7 +251,7 @@ describe('Design discussions component', () => {
describe('when any note from a discussion is active', () => { describe('when any note from a discussion is active', () => {
it.each([notes[0], notes[0].discussion.notes.nodes[1]])( it.each([notes[0], notes[0].discussion.notes.nodes[1]])(
'applies correct class to all notes in the active discussion', 'applies correct class to all notes in the active discussion',
note => { (note) => {
createComponent( createComponent(
{ discussion: mockDiscussion }, { discussion: mockDiscussion },
{ {
...@@ -265,7 +265,7 @@ describe('Design discussions component', () => { ...@@ -265,7 +265,7 @@ describe('Design discussions component', () => {
expect( expect(
wrapper wrapper
.findAll(DesignNote) .findAll(DesignNote)
.wrappers.every(designNote => designNote.classes('gl-bg-blue-50')), .wrappers.every((designNote) => designNote.classes('gl-bg-blue-50')),
).toBe(true); ).toBe(true);
}, },
); );
......
...@@ -13,7 +13,7 @@ describe('Design overlay component', () => { ...@@ -13,7 +13,7 @@ describe('Design overlay component', () => {
const findAllNotes = () => wrapper.findAll('.js-image-badge'); const findAllNotes = () => wrapper.findAll('.js-image-badge');
const findCommentBadge = () => wrapper.find('.comment-indicator'); const findCommentBadge = () => wrapper.find('.comment-indicator');
const findBadgeAtIndex = noteIndex => findAllNotes().at(noteIndex); const findBadgeAtIndex = (noteIndex) => findAllNotes().at(noteIndex);
const findFirstBadge = () => findBadgeAtIndex(0); const findFirstBadge = () => findBadgeAtIndex(0);
const findSecondBadge = () => findBadgeAtIndex(1); const findSecondBadge = () => findBadgeAtIndex(1);
...@@ -108,7 +108,7 @@ describe('Design overlay component', () => { ...@@ -108,7 +108,7 @@ describe('Design overlay component', () => {
describe('when no discussion is active', () => { describe('when no discussion is active', () => {
it('should not apply inactive class to any pins', () => { it('should not apply inactive class to any pins', () => {
expect( expect(
findAllNotes(0).wrappers.every(designNote => designNote.classes('gl-bg-blue-50')), findAllNotes(0).wrappers.every((designNote) => designNote.classes('gl-bg-blue-50')),
).toBe(false); ).toBe(false);
}); });
}); });
...@@ -116,7 +116,7 @@ describe('Design overlay component', () => { ...@@ -116,7 +116,7 @@ describe('Design overlay component', () => {
describe('when a discussion is active', () => { describe('when a discussion is active', () => {
it.each([notes[0].discussion.notes.nodes[1], notes[0].discussion.notes.nodes[0]])( it.each([notes[0].discussion.notes.nodes[1], notes[0].discussion.notes.nodes[0]])(
'should not apply inactive class to the pin for the active discussion', 'should not apply inactive class to the pin for the active discussion',
note => { (note) => {
wrapper.setData({ wrapper.setData({
activeDiscussion: { activeDiscussion: {
id: note.id, id: note.id,
......
...@@ -10,7 +10,7 @@ describe('Design management design scaler component', () => { ...@@ -10,7 +10,7 @@ describe('Design management design scaler component', () => {
const getResetScaleButton = () => getButtons().at(1); const getResetScaleButton = () => getButtons().at(1);
const getIncreaseScaleButton = () => getButtons().at(2); const getIncreaseScaleButton = () => getButtons().at(2);
const setScale = scale => wrapper.vm.setScale(scale); const setScale = (scale) => wrapper.vm.setScale(scale);
const createComponent = () => { const createComponent = () => {
wrapper = shallowMount(DesignScaler); wrapper = shallowMount(DesignScaler);
......
...@@ -6,7 +6,7 @@ import mockAllVersions from './mock_data/all_versions'; ...@@ -6,7 +6,7 @@ import mockAllVersions from './mock_data/all_versions';
const LATEST_VERSION_ID = 3; const LATEST_VERSION_ID = 3;
const PREVIOUS_VERSION_ID = 2; const PREVIOUS_VERSION_ID = 2;
const designRouteFactory = versionId => ({ const designRouteFactory = (versionId) => ({
path: `/designs?version=${versionId}`, path: `/designs?version=${versionId}`,
query: { query: {
version: `${versionId}`, version: `${versionId}`,
...@@ -42,7 +42,7 @@ describe('Design management design version dropdown component', () => { ...@@ -42,7 +42,7 @@ describe('Design management design version dropdown component', () => {
wrapper.destroy(); wrapper.destroy();
}); });
const findVersionLink = index => wrapper.findAll(GlDropdownItem).at(index); const findVersionLink = (index) => wrapper.findAll(GlDropdownItem).at(index);
it('renders design version dropdown button', () => { it('renders design version dropdown button', () => {
createComponent(); createComponent();
......
...@@ -572,7 +572,7 @@ describe('Design management index page', () => { ...@@ -572,7 +572,7 @@ describe('Design management index page', () => {
return wrapper.vm.$nextTick().then(() => { return wrapper.vm.$nextTick().then(() => {
expect(findDeleteButton().props().hasSelectedDesigns).toBe(true); expect(findDeleteButton().props().hasSelectedDesigns).toBe(true);
expect(findSelectAllButton().text()).toBe('Deselect all'); expect(findSelectAllButton().text()).toBe('Deselect all');
expect(wrapper.vm.selectedDesigns).toEqual(mockDesigns.map(design => design.filename)); expect(wrapper.vm.selectedDesigns).toEqual(mockDesigns.map((design) => design.filename));
}); });
}); });
......
...@@ -40,7 +40,7 @@ describe('Design management router', () => { ...@@ -40,7 +40,7 @@ describe('Design management router', () => {
window.location.hash = ''; window.location.hash = '';
}); });
describe.each([['/'], [{ name: DESIGNS_ROUTE_NAME }]])('root route', routeArg => { describe.each([['/'], [{ name: DESIGNS_ROUTE_NAME }]])('root route', (routeArg) => {
it('pushes home component', () => { it('pushes home component', () => {
const wrapper = factory(routeArg); const wrapper = factory(routeArg);
...@@ -50,7 +50,7 @@ describe('Design management router', () => { ...@@ -50,7 +50,7 @@ describe('Design management router', () => {
describe.each([['/designs/1'], [{ name: DESIGN_ROUTE_NAME, params: { id: '1' } }]])( describe.each([['/designs/1'], [{ name: DESIGN_ROUTE_NAME, params: { id: '1' } }]])(
'designs detail route', 'designs detail route',
routeArg => { (routeArg) => {
it('pushes designs detail component', () => { it('pushes designs detail component', () => {
const wrapper = factory(routeArg); const wrapper = factory(routeArg);
......
...@@ -3,7 +3,7 @@ import { ...@@ -3,7 +3,7 @@ import {
designUploadSkippedWarning, designUploadSkippedWarning,
} from '~/design_management/utils/error_messages'; } from '~/design_management/utils/error_messages';
const mockFilenames = n => const mockFilenames = (n) =>
Array(n) Array(n)
.fill(0) .fill(0)
.map((_, i) => ({ filename: `${i + 1}.jpg` })); .map((_, i) => ({ filename: `${i + 1}.jpg` }));
...@@ -14,7 +14,7 @@ describe('Error message', () => { ...@@ -14,7 +14,7 @@ describe('Error message', () => {
const pluralMsg = 'Could not archive designs. Please try again.'; const pluralMsg = 'Could not archive designs. Please try again.';
describe('when [singular=true]', () => { describe('when [singular=true]', () => {
it.each([[undefined], [true]])('uses singular grammar', singularOption => { it.each([[undefined], [true]])('uses singular grammar', (singularOption) => {
expect(designDeletionError({ singular: singularOption })).toEqual(singularMsg); expect(designDeletionError({ singular: singularOption })).toEqual(singularMsg);
}); });
}); });
......
...@@ -102,13 +102,13 @@ describe('diffs/components/app', () => { ...@@ -102,13 +102,13 @@ describe('diffs/components/app', () => {
}); });
describe('fetch diff methods', () => { describe('fetch diff methods', () => {
beforeEach(done => { beforeEach((done) => {
const fetchResolver = () => { const fetchResolver = () => {
store.state.diffs.retrievingBatches = false; store.state.diffs.retrievingBatches = false;
store.state.notes.discussions = 'test'; store.state.notes.discussions = 'test';
return Promise.resolve({ real_size: 100 }); return Promise.resolve({ real_size: 100 });
}; };
jest.spyOn(window, 'requestIdleCallback').mockImplementation(fn => fn()); jest.spyOn(window, 'requestIdleCallback').mockImplementation((fn) => fn());
createComponent(); createComponent();
jest.spyOn(wrapper.vm, 'fetchDiffFilesMeta').mockImplementation(fetchResolver); jest.spyOn(wrapper.vm, 'fetchDiffFilesMeta').mockImplementation(fetchResolver);
jest.spyOn(wrapper.vm, 'fetchDiffFilesBatch').mockImplementation(fetchResolver); jest.spyOn(wrapper.vm, 'fetchDiffFilesBatch').mockImplementation(fetchResolver);
...@@ -122,7 +122,7 @@ describe('diffs/components/app', () => { ...@@ -122,7 +122,7 @@ describe('diffs/components/app', () => {
wrapper.vm.$nextTick(done); wrapper.vm.$nextTick(done);
}); });
it('calls batch methods if diffsBatchLoad is enabled, and not latest version', done => { it('calls batch methods if diffsBatchLoad is enabled, and not latest version', (done) => {
expect(wrapper.vm.diffFilesLength).toEqual(0); expect(wrapper.vm.diffFilesLength).toEqual(0);
wrapper.vm.isLatestVersion = () => false; wrapper.vm.isLatestVersion = () => false;
wrapper.vm.fetchData(false); wrapper.vm.fetchData(false);
...@@ -139,7 +139,7 @@ describe('diffs/components/app', () => { ...@@ -139,7 +139,7 @@ describe('diffs/components/app', () => {
}); });
}); });
it('calls batch methods if diffsBatchLoad is enabled, and latest version', done => { it('calls batch methods if diffsBatchLoad is enabled, and latest version', (done) => {
expect(wrapper.vm.diffFilesLength).toEqual(0); expect(wrapper.vm.diffFilesLength).toEqual(0);
wrapper.vm.fetchData(false); wrapper.vm.fetchData(false);
...@@ -216,7 +216,7 @@ describe('diffs/components/app', () => { ...@@ -216,7 +216,7 @@ describe('diffs/components/app', () => {
window.location.hash = 'ABC_123'; window.location.hash = 'ABC_123';
}); });
it('sets highlighted row if hash exists in location object', done => { it('sets highlighted row if hash exists in location object', (done) => {
createComponent({ createComponent({
shouldShow: true, shouldShow: true,
}); });
...@@ -267,7 +267,7 @@ describe('diffs/components/app', () => { ...@@ -267,7 +267,7 @@ describe('diffs/components/app', () => {
}); });
}); });
it('marks current diff file based on currently highlighted row', done => { it('marks current diff file based on currently highlighted row', (done) => {
createComponent({ createComponent({
shouldShow: true, shouldShow: true,
}); });
...@@ -439,7 +439,7 @@ describe('diffs/components/app', () => { ...@@ -439,7 +439,7 @@ describe('diffs/components/app', () => {
wrapper.destroy(); wrapper.destroy();
}); });
it('jumps to next and previous files in the list', done => { it('jumps to next and previous files in the list', (done) => {
wrapper.vm wrapper.vm
.$nextTick() .$nextTick()
.then(() => { .then(() => {
...@@ -459,7 +459,7 @@ describe('diffs/components/app', () => { ...@@ -459,7 +459,7 @@ describe('diffs/components/app', () => {
.catch(done.fail); .catch(done.fail);
}); });
it('does not jump to previous file from the first one', done => { it('does not jump to previous file from the first one', (done) => {
wrapper.vm wrapper.vm
.$nextTick() .$nextTick()
.then(() => { .then(() => {
...@@ -476,7 +476,7 @@ describe('diffs/components/app', () => { ...@@ -476,7 +476,7 @@ describe('diffs/components/app', () => {
.catch(done.fail); .catch(done.fail);
}); });
it('does not jump to next file from the last one', done => { it('does not jump to next file from the last one', (done) => {
wrapper.vm wrapper.vm
.$nextTick() .$nextTick()
.then(() => { .then(() => {
......
...@@ -31,7 +31,7 @@ describe('CompareDropdownLayout', () => { ...@@ -31,7 +31,7 @@ describe('CompareDropdownLayout', () => {
const findListItems = () => wrapper.findAll('li'); const findListItems = () => wrapper.findAll('li');
const findListItemsData = () => const findListItemsData = () =>
findListItems().wrappers.map(listItem => ({ findListItems().wrappers.map((listItem) => ({
href: listItem.find('a').attributes('href'), href: listItem.find('a').attributes('href'),
text: trimText(listItem.text()), text: trimText(listItem.text()),
createdAt: listItem.findAll(TimeAgo).wrappers[0]?.props('time'), createdAt: listItem.findAll(TimeAgo).wrappers[0]?.props('time'),
......
...@@ -13,7 +13,7 @@ describe('CompareVersions', () => { ...@@ -13,7 +13,7 @@ describe('CompareVersions', () => {
let wrapper; let wrapper;
const targetBranchName = 'tmp-wine-dev'; const targetBranchName = 'tmp-wine-dev';
const createWrapper = props => { const createWrapper = (props) => {
const store = createStore(); const store = createStore();
const mergeRequestDiff = diffsMockData[0]; const mergeRequestDiff = diffsMockData[0];
...@@ -121,7 +121,7 @@ describe('CompareVersions', () => { ...@@ -121,7 +121,7 @@ describe('CompareVersions', () => {
}); });
describe('commit', () => { describe('commit', () => {
beforeEach(done => { beforeEach((done) => {
wrapper.vm.$store.state.diffs.commit = getDiffWithCommit().commit; wrapper.vm.$store.state.diffs.commit = getDiffWithCommit().commit;
wrapper.mergeRequestDiffs = []; wrapper.mergeRequestDiffs = [];
......
...@@ -102,7 +102,7 @@ describe('DiffContent', () => { ...@@ -102,7 +102,7 @@ describe('DiffContent', () => {
describe('with text based files', () => { describe('with text based files', () => {
afterEach(() => { afterEach(() => {
[isParallelViewGetterMock, isInlineViewGetterMock].forEach(m => m.mockRestore()); [isParallelViewGetterMock, isInlineViewGetterMock].forEach((m) => m.mockRestore());
}); });
const textDiffFile = { ...defaultProps.diffFile, viewer: { name: diffViewerModes.text } }; const textDiffFile = { ...defaultProps.diffFile, viewer: { name: diffViewerModes.text } };
......
...@@ -15,7 +15,7 @@ describe('DiffDiscussions', () => { ...@@ -15,7 +15,7 @@ describe('DiffDiscussions', () => {
let wrapper; let wrapper;
const getDiscussionsMockData = () => [{ ...discussionsMockData }]; const getDiscussionsMockData = () => [{ ...discussionsMockData }];
const createComponent = props => { const createComponent = (props) => {
store = createStore(); store = createStore();
wrapper = mount(localVue.extend(DiffDiscussions), { wrapper = mount(localVue.extend(DiffDiscussions), {
store, store,
......
...@@ -14,7 +14,7 @@ const lineSources = { ...@@ -14,7 +14,7 @@ const lineSources = {
[INLINE_DIFF_VIEW_TYPE]: 'highlighted_diff_lines', [INLINE_DIFF_VIEW_TYPE]: 'highlighted_diff_lines',
}; };
const lineHandlers = { const lineHandlers = {
[INLINE_DIFF_VIEW_TYPE]: line => line, [INLINE_DIFF_VIEW_TYPE]: (line) => line,
}; };
function makeLoadMoreLinesPayload({ function makeLoadMoreLinesPayload({
......
...@@ -96,13 +96,13 @@ function createComponent({ file, first = false, last = false }) { ...@@ -96,13 +96,13 @@ function createComponent({ file, first = false, last = false }) {
}; };
} }
const findDiffHeader = wrapper => wrapper.find(DiffFileHeaderComponent); const findDiffHeader = (wrapper) => wrapper.find(DiffFileHeaderComponent);
const findDiffContentArea = wrapper => wrapper.find('[data-testid="content-area"]'); const findDiffContentArea = (wrapper) => wrapper.find('[data-testid="content-area"]');
const findLoader = wrapper => wrapper.find('[data-testid="loader-icon"]'); const findLoader = (wrapper) => wrapper.find('[data-testid="loader-icon"]');
const findToggleButton = wrapper => wrapper.find('[data-testid="expand-button"]'); const findToggleButton = (wrapper) => wrapper.find('[data-testid="expand-button"]');
const toggleFile = wrapper => findDiffHeader(wrapper).vm.$emit('toggleFile'); const toggleFile = (wrapper) => findDiffHeader(wrapper).vm.$emit('toggleFile');
const isDisplayNone = element => element.style.display === 'none'; const isDisplayNone = (element) => element.style.display === 'none';
const getReadableFile = () => JSON.parse(JSON.stringify(diffFileMockDataReadable)); const getReadableFile = () => JSON.parse(JSON.stringify(diffFileMockDataReadable));
const getUnreadableFile = () => JSON.parse(JSON.stringify(diffFileMockDataUnreadable)); const getUnreadableFile = () => JSON.parse(JSON.stringify(diffFileMockDataUnreadable));
...@@ -157,7 +157,7 @@ describe('DiffFile', () => { ...@@ -157,7 +157,7 @@ describe('DiffFile', () => {
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
expect(eventHub.$emit).toHaveBeenCalledTimes(events.length); expect(eventHub.$emit).toHaveBeenCalledTimes(events.length);
events.forEach(event => { events.forEach((event) => {
expect(eventHub.$emit).toHaveBeenCalledWith(event); expect(eventHub.$emit).toHaveBeenCalledWith(event);
}); });
}, },
...@@ -174,7 +174,7 @@ describe('DiffFile', () => { ...@@ -174,7 +174,7 @@ describe('DiffFile', () => {
})); }));
jest.spyOn(wrapper.vm, 'loadCollapsedDiff').mockResolvedValue(getReadableFile()); jest.spyOn(wrapper.vm, 'loadCollapsedDiff').mockResolvedValue(getReadableFile());
jest.spyOn(window, 'requestIdleCallback').mockImplementation(fn => fn()); jest.spyOn(window, 'requestIdleCallback').mockImplementation((fn) => fn());
makeFileAutomaticallyCollapsed(store); makeFileAutomaticallyCollapsed(store);
...@@ -247,7 +247,7 @@ describe('DiffFile', () => { ...@@ -247,7 +247,7 @@ describe('DiffFile', () => {
it('should not have any content at all', async () => { it('should not have any content at all', async () => {
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
Array.from(findDiffContentArea(wrapper).element.children).forEach(child => { Array.from(findDiffContentArea(wrapper).element.children).forEach((child) => {
expect(isDisplayNone(child)).toBe(true); expect(isDisplayNone(child)).toBe(true);
}); });
}); });
......
...@@ -51,7 +51,7 @@ describe('DiffLineNoteForm', () => { ...@@ -51,7 +51,7 @@ describe('DiffLineNoteForm', () => {
expect(window.confirm).not.toHaveBeenCalled(); expect(window.confirm).not.toHaveBeenCalled();
}); });
it('should call cancelCommentForm with lineCode', done => { it('should call cancelCommentForm with lineCode', (done) => {
jest.spyOn(window, 'confirm').mockImplementation(() => {}); jest.spyOn(window, 'confirm').mockImplementation(() => {});
jest.spyOn(wrapper.vm, 'cancelCommentForm').mockImplementation(() => {}); jest.spyOn(wrapper.vm, 'cancelCommentForm').mockImplementation(() => {});
jest.spyOn(wrapper.vm, 'resetAutoSave').mockImplementation(() => {}); jest.spyOn(wrapper.vm, 'resetAutoSave').mockImplementation(() => {});
...@@ -72,7 +72,7 @@ describe('DiffLineNoteForm', () => { ...@@ -72,7 +72,7 @@ describe('DiffLineNoteForm', () => {
}); });
describe('saveNoteForm', () => { describe('saveNoteForm', () => {
it('should call saveNote action with proper params', done => { it('should call saveNote action with proper params', (done) => {
const saveDiffDiscussionSpy = jest const saveDiffDiscussionSpy = jest
.spyOn(wrapper.vm, 'saveDiffDiscussion') .spyOn(wrapper.vm, 'saveDiffDiscussion')
.mockReturnValue(Promise.resolve()); .mockReturnValue(Promise.resolve());
......
...@@ -39,7 +39,7 @@ describe('diff_stats', () => { ...@@ -39,7 +39,7 @@ describe('diff_stats', () => {
}); });
describe('line changes', () => { describe('line changes', () => {
const findFileLine = name => wrapper.find(name); const findFileLine = (name) => wrapper.find(name);
it('shows the amount of lines added', () => { it('shows the amount of lines added', () => {
expect(findFileLine('.js-file-addition-line').text()).toBe(TEST_ADDED_LINES.toString()); expect(findFileLine('.js-file-addition-line').text()).toBe(TEST_ADDED_LINES.toString());
...@@ -51,10 +51,10 @@ describe('diff_stats', () => { ...@@ -51,10 +51,10 @@ describe('diff_stats', () => {
}); });
describe('files changes', () => { describe('files changes', () => {
const findIcon = name => const findIcon = (name) =>
wrapper wrapper
.findAll(GlIcon) .findAll(GlIcon)
.filter(c => c.attributes('name') === name) .filter((c) => c.attributes('name') === name)
.at(0).element.parentNode; .at(0).element.parentNode;
it('shows amount of file changed with plural "files" when 0 files has changed', () => { it('shows amount of file changed with plural "files" when 0 files has changed', () => {
......
...@@ -11,7 +11,7 @@ describe('DiffView', () => { ...@@ -11,7 +11,7 @@ describe('DiffView', () => {
const DiffRow = { template: `<div/>` }; const DiffRow = { template: `<div/>` };
const DiffCommentCell = { template: `<div/>` }; const DiffCommentCell = { template: `<div/>` };
const DraftNote = { template: `<div/>` }; const DraftNote = { template: `<div/>` };
const createWrapper = props => { const createWrapper = (props) => {
const localVue = createLocalVue(); const localVue = createLocalVue();
localVue.use(Vuex); localVue.use(Vuex);
......
...@@ -114,7 +114,7 @@ describe('Diffs image diff overlay component', () => { ...@@ -114,7 +114,7 @@ describe('Diffs image diff overlay component', () => {
describe('comment form', () => { describe('comment form', () => {
const getCommentIndicator = () => wrapper.find('.comment-indicator'); const getCommentIndicator = () => wrapper.find('.comment-indicator');
beforeEach(() => { beforeEach(() => {
createComponent({ canComment: true }, store => { createComponent({ canComment: true }, (store) => {
store.state.diffs.commentForms.push({ store.state.diffs.commentForms.push({
fileHash: 'ABC', fileHash: 'ABC',
x: 20, x: 20,
......
...@@ -28,7 +28,7 @@ describe('Diff no changes empty state', () => { ...@@ -28,7 +28,7 @@ describe('Diff no changes empty state', () => {
}); });
it('prevents XSS', () => { it('prevents XSS', () => {
createComponent(store => { createComponent((store) => {
// eslint-disable-next-line no-param-reassign // eslint-disable-next-line no-param-reassign
store.state.notes.noteableData = { store.state.notes.noteableData = {
source_branch: '<script>alert("test");</script>', source_branch: '<script>alert("test");</script>',
......
...@@ -40,7 +40,7 @@ describe('ParallelDiffTableRow', () => { ...@@ -40,7 +40,7 @@ describe('ParallelDiffTableRow', () => {
vm = wrapper.vm; vm = wrapper.vm;
}); });
it('does not highlight non empty line content when line does not match highlighted row', done => { it('does not highlight non empty line content when line does not match highlighted row', (done) => {
vm.$nextTick() vm.$nextTick()
.then(() => { .then(() => {
expect(vm.$el.querySelector('.line_content.right-side').classList).not.toContain('hll'); expect(vm.$el.querySelector('.line_content.right-side').classList).not.toContain('hll');
...@@ -49,7 +49,7 @@ describe('ParallelDiffTableRow', () => { ...@@ -49,7 +49,7 @@ describe('ParallelDiffTableRow', () => {
.catch(done.fail); .catch(done.fail);
}); });
it('highlights nonempty line content when line is the highlighted row', done => { it('highlights nonempty line content when line is the highlighted row', (done) => {
vm.$nextTick() vm.$nextTick()
.then(() => { .then(() => {
vm.$store.state.diffs.highlightedRow = rightLine.line_code; vm.$store.state.diffs.highlightedRow = rightLine.line_code;
...@@ -86,7 +86,7 @@ describe('ParallelDiffTableRow', () => { ...@@ -86,7 +86,7 @@ describe('ParallelDiffTableRow', () => {
}).$mount(); }).$mount();
}); });
it('does not highlight either line when line does not match highlighted row', done => { it('does not highlight either line when line does not match highlighted row', (done) => {
vm.$nextTick() vm.$nextTick()
.then(() => { .then(() => {
expect(vm.$el.querySelector('.line_content.right-side').classList).not.toContain('hll'); expect(vm.$el.querySelector('.line_content.right-side').classList).not.toContain('hll');
...@@ -96,7 +96,7 @@ describe('ParallelDiffTableRow', () => { ...@@ -96,7 +96,7 @@ describe('ParallelDiffTableRow', () => {
.catch(done.fail); .catch(done.fail);
}); });
it('adds hll class to lineContent when line is the highlighted row', done => { it('adds hll class to lineContent when line is the highlighted row', (done) => {
vm.$nextTick() vm.$nextTick()
.then(() => { .then(() => {
vm.$store.state.diffs.highlightedRow = rightLine.line_code; vm.$store.state.diffs.highlightedRow = rightLine.line_code;
...@@ -112,7 +112,7 @@ describe('ParallelDiffTableRow', () => { ...@@ -112,7 +112,7 @@ describe('ParallelDiffTableRow', () => {
}); });
describe('sets coverage title and class', () => { describe('sets coverage title and class', () => {
it('for lines with coverage', done => { it('for lines with coverage', (done) => {
vm.$nextTick() vm.$nextTick()
.then(() => { .then(() => {
const name = diffFileMockData.file_path; const name = diffFileMockData.file_path;
...@@ -132,7 +132,7 @@ describe('ParallelDiffTableRow', () => { ...@@ -132,7 +132,7 @@ describe('ParallelDiffTableRow', () => {
.catch(done.fail); .catch(done.fail);
}); });
it('for lines without coverage', done => { it('for lines without coverage', (done) => {
vm.$nextTick() vm.$nextTick()
.then(() => { .then(() => {
const name = diffFileMockData.file_path; const name = diffFileMockData.file_path;
...@@ -152,7 +152,7 @@ describe('ParallelDiffTableRow', () => { ...@@ -152,7 +152,7 @@ describe('ParallelDiffTableRow', () => {
.catch(done.fail); .catch(done.fail);
}); });
it('for unknown lines', done => { it('for unknown lines', (done) => {
vm.$nextTick() vm.$nextTick()
.then(() => { .then(() => {
vm.$store.state.diffs.coverageFiles = {}; vm.$store.state.diffs.coverageFiles = {};
......
...@@ -73,7 +73,7 @@ describe('Diff settings dropdown component', () => { ...@@ -73,7 +73,7 @@ describe('Diff settings dropdown component', () => {
}); });
it('sets list button as selected when renderTreeList is false', () => { it('sets list button as selected when renderTreeList is false', () => {
createComponent(store => { createComponent((store) => {
Object.assign(store.state.diffs, { Object.assign(store.state.diffs, {
renderTreeList: false, renderTreeList: false,
}); });
...@@ -84,7 +84,7 @@ describe('Diff settings dropdown component', () => { ...@@ -84,7 +84,7 @@ describe('Diff settings dropdown component', () => {
}); });
it('sets tree button as selected when renderTreeList is true', () => { it('sets tree button as selected when renderTreeList is true', () => {
createComponent(store => { createComponent((store) => {
Object.assign(store.state.diffs, { Object.assign(store.state.diffs, {
renderTreeList: true, renderTreeList: true,
}); });
...@@ -97,7 +97,7 @@ describe('Diff settings dropdown component', () => { ...@@ -97,7 +97,7 @@ describe('Diff settings dropdown component', () => {
describe('compare changes', () => { describe('compare changes', () => {
it('sets inline button as selected', () => { it('sets inline button as selected', () => {
createComponent(store => { createComponent((store) => {
Object.assign(store.state.diffs, { Object.assign(store.state.diffs, {
diffViewType: INLINE_DIFF_VIEW_TYPE, diffViewType: INLINE_DIFF_VIEW_TYPE,
}); });
...@@ -108,7 +108,7 @@ describe('Diff settings dropdown component', () => { ...@@ -108,7 +108,7 @@ describe('Diff settings dropdown component', () => {
}); });
it('sets parallel button as selected', () => { it('sets parallel button as selected', () => {
createComponent(store => { createComponent((store) => {
Object.assign(store.state.diffs, { Object.assign(store.state.diffs, {
diffViewType: PARALLEL_DIFF_VIEW_TYPE, diffViewType: PARALLEL_DIFF_VIEW_TYPE,
}); });
...@@ -137,7 +137,7 @@ describe('Diff settings dropdown component', () => { ...@@ -137,7 +137,7 @@ describe('Diff settings dropdown component', () => {
describe('whitespace toggle', () => { describe('whitespace toggle', () => {
it('does not set as checked when showWhitespace is false', () => { it('does not set as checked when showWhitespace is false', () => {
createComponent(store => { createComponent((store) => {
Object.assign(store.state.diffs, { Object.assign(store.state.diffs, {
showWhitespace: false, showWhitespace: false,
}); });
...@@ -147,7 +147,7 @@ describe('Diff settings dropdown component', () => { ...@@ -147,7 +147,7 @@ describe('Diff settings dropdown component', () => {
}); });
it('sets as checked when showWhitespace is true', () => { it('sets as checked when showWhitespace is true', () => {
createComponent(store => { createComponent((store) => {
Object.assign(store.state.diffs, { Object.assign(store.state.diffs, {
showWhitespace: true, showWhitespace: true,
}); });
...@@ -183,7 +183,7 @@ describe('Diff settings dropdown component', () => { ...@@ -183,7 +183,7 @@ describe('Diff settings dropdown component', () => {
`( `(
'sets the checkbox to { checked: $checked } if the fileByFile setting is $fileByFile', 'sets the checkbox to { checked: $checked } if the fileByFile setting is $fileByFile',
async ({ fileByFile, checked }) => { async ({ fileByFile, checked }) => {
createComponent(store => { createComponent((store) => {
Object.assign(store.state.diffs, { Object.assign(store.state.diffs, {
viewDiffsFileByFile: fileByFile, viewDiffsFileByFile: fileByFile,
}); });
...@@ -202,7 +202,7 @@ describe('Diff settings dropdown component', () => { ...@@ -202,7 +202,7 @@ describe('Diff settings dropdown component', () => {
`( `(
'when the file by file setting starts as $start, toggling the checkbox should emit an event set to $emit', 'when the file by file setting starts as $start, toggling the checkbox should emit an event set to $emit',
async ({ start, emit }) => { async ({ start, emit }) => {
createComponent(store => { createComponent((store) => {
Object.assign(store.state.diffs, { Object.assign(store.state.diffs, {
viewDiffsFileByFile: start, viewDiffsFileByFile: start,
}); });
......
This diff is collapsed.
...@@ -49,7 +49,7 @@ describe('Compare diff version dropdowns', () => { ...@@ -49,7 +49,7 @@ describe('Compare diff version dropdowns', () => {
let expectedHeadVersion; let expectedHeadVersion;
const originalLocation = window.location; const originalLocation = window.location;
const setupTest = includeDiffHeadParam => { const setupTest = (includeDiffHeadParam) => {
const diffHeadParam = includeDiffHeadParam ? '?diff_head=true' : ''; const diffHeadParam = includeDiffHeadParam ? '?diff_head=true' : '';
Object.defineProperty(window, 'location', { Object.defineProperty(window, 'location', {
...@@ -81,7 +81,7 @@ describe('Compare diff version dropdowns', () => { ...@@ -81,7 +81,7 @@ describe('Compare diff version dropdowns', () => {
}; };
}; };
const assertVersions = targetVersions => { const assertVersions = (targetVersions) => {
// base and head should be the last two versions in that order // base and head should be the last two versions in that order
const targetBaseVersion = targetVersions[targetVersions.length - 2]; const targetBaseVersion = targetVersions[targetVersions.length - 2];
const targetHeadVersion = targetVersions[targetVersions.length - 1]; const targetHeadVersion = targetVersions[targetVersions.length - 1];
......
...@@ -481,7 +481,7 @@ describe('DiffsStoreUtils', () => { ...@@ -481,7 +481,7 @@ describe('DiffsStoreUtils', () => {
}); });
it('adds the `.brokenSymlink` property to each diff file', () => { it('adds the `.brokenSymlink` property to each diff file', () => {
preparedDiff.diff_files.forEach(file => { preparedDiff.diff_files.forEach((file) => {
expect(file).toEqual(expect.objectContaining({ brokenSymlink: false })); expect(file).toEqual(expect.objectContaining({ brokenSymlink: false }));
}); });
}); });
...@@ -492,9 +492,9 @@ describe('DiffsStoreUtils', () => { ...@@ -492,9 +492,9 @@ describe('DiffsStoreUtils', () => {
...splitInlineDiff.diff_files, ...splitInlineDiff.diff_files,
...splitParallelDiff.diff_files, ...splitParallelDiff.diff_files,
...completedDiff.diff_files, ...completedDiff.diff_files,
].flatMap(file => [...file[INLINE_DIFF_LINES_KEY]]); ].flatMap((file) => [...file[INLINE_DIFF_LINES_KEY]]);
lines.forEach(line => { lines.forEach((line) => {
expect(line.commentsDisabled).toBe(false); expect(line.commentsDisabled).toBe(false);
}); });
}); });
...@@ -560,7 +560,7 @@ describe('DiffsStoreUtils', () => { ...@@ -560,7 +560,7 @@ describe('DiffsStoreUtils', () => {
}); });
it('adds the `.brokenSymlink` property to each meta diff file', () => { it('adds the `.brokenSymlink` property to each meta diff file', () => {
preparedDiffFiles.forEach(file => { preparedDiffFiles.forEach((file) => {
expect(file).toMatchObject({ brokenSymlink: false }); expect(file).toMatchObject({ brokenSymlink: false });
}); });
}); });
......
...@@ -32,7 +32,7 @@ describe('UUIDs Util', () => { ...@@ -32,7 +32,7 @@ describe('UUIDs Util', () => {
const ids = uuids({ count: 11 }); const ids = uuids({ count: 11 });
expect(ids.length).toEqual(11); expect(ids.length).toEqual(11);
expect(ids.every(id => UUIDV4.test(id))).toEqual(true); expect(ids.every((id) => UUIDV4.test(id))).toEqual(true);
}); });
it.each` it.each`
......
import DirtySubmitCollection from '~/dirty_submit/dirty_submit_collection'; import DirtySubmitCollection from '~/dirty_submit/dirty_submit_collection';
import { setInputValue, createForm } from './helper'; import { setInputValue, createForm } from './helper';
jest.mock('lodash/throttle', () => jest.fn(fn => fn)); jest.mock('lodash/throttle', () => jest.fn((fn) => fn));
describe('DirtySubmitCollection', () => { describe('DirtySubmitCollection', () => {
const testElementsCollection = [createForm(), createForm()]; const testElementsCollection = [createForm(), createForm()];
const forms = testElementsCollection.map(testElements => testElements.form); const forms = testElementsCollection.map((testElements) => testElements.form);
new DirtySubmitCollection(forms); // eslint-disable-line no-new new DirtySubmitCollection(forms); // eslint-disable-line no-new
it.each(testElementsCollection)('disables submits until there are changes', testElements => { it.each(testElementsCollection)('disables submits until there are changes', (testElements) => {
const { input, submit } = testElements; const { input, submit } = testElements;
const originalValue = input.value; const originalValue = input.value;
......
...@@ -2,7 +2,7 @@ import { range as rge, throttle } from 'lodash'; ...@@ -2,7 +2,7 @@ import { range as rge, throttle } from 'lodash';
import DirtySubmitForm from '~/dirty_submit/dirty_submit_form'; import DirtySubmitForm from '~/dirty_submit/dirty_submit_form';
import { getInputValue, setInputValue, createForm } from './helper'; import { getInputValue, setInputValue, createForm } from './helper';
jest.mock('lodash/throttle', () => jest.fn(fn => fn)); jest.mock('lodash/throttle', () => jest.fn((fn) => fn));
const lodash = jest.requireActual('lodash'); const lodash = jest.requireActual('lodash');
function expectToToggleDisableOnDirtyUpdate(submit, input) { function expectToToggleDisableOnDirtyUpdate(submit, input) {
...@@ -66,7 +66,7 @@ describe('DirtySubmitForm', () => { ...@@ -66,7 +66,7 @@ describe('DirtySubmitForm', () => {
const { form, input } = createForm(); const { form, input } = createForm();
const updateDirtyInputSpy = jest.spyOn(new DirtySubmitForm(form), 'updateDirtyInput'); const updateDirtyInputSpy = jest.spyOn(new DirtySubmitForm(form), 'updateDirtyInput');
rge(10).forEach(i => { rge(10).forEach((i) => {
setInputValue(input, `change ${i}`, false); setInputValue(input, `change ${i}`, false);
}); });
...@@ -78,13 +78,13 @@ describe('DirtySubmitForm', () => { ...@@ -78,13 +78,13 @@ describe('DirtySubmitForm', () => {
it('does not throttle updates when rapid changes are made to different form elements', () => { it('does not throttle updates when rapid changes are made to different form elements', () => {
const form = document.createElement('form'); const form = document.createElement('form');
const range = rge(10); const range = rge(10);
range.forEach(i => { range.forEach((i) => {
form.innerHTML += `<input type="text" name="input-${i}" class="js-input-${i}"/>`; form.innerHTML += `<input type="text" name="input-${i}" class="js-input-${i}"/>`;
}); });
const updateDirtyInputSpy = jest.spyOn(new DirtySubmitForm(form), 'updateDirtyInput'); const updateDirtyInputSpy = jest.spyOn(new DirtySubmitForm(form), 'updateDirtyInput');
range.forEach(i => { range.forEach((i) => {
const input = form.querySelector(`.js-input-${i}`); const input = form.querySelector(`.js-input-${i}`);
setInputValue(input, `change`, false); setInputValue(input, `change`, 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