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
spec/frontend/behaviors/quick_submit_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
spec/frontend/droplab/drop_down_spec.js
spec/frontend/droplab/plugins/ajax_filter_spec.js
......
......@@ -5,7 +5,7 @@ import LimitWarningComponent from '~/cycle_analytics/components/limit_warning_co
Vue.use(Translate);
const createComponent = props =>
const createComponent = (props) =>
shallowMount(LimitWarningComponent, {
propsData: {
...props,
......
......@@ -30,7 +30,7 @@ describe('Deploy freeze timezone dropdown', () => {
};
const findAllDropdownItems = () => wrapper.findAll(GlDropdownItem);
const findDropdownItemByIndex = index => wrapper.findAll(GlDropdownItem).at(index);
const findDropdownItemByIndex = (index) => wrapper.findAll(GlDropdownItem).at(index);
afterEach(() => {
wrapper.destroy();
......
......@@ -9,9 +9,9 @@ describe('Deploy keys key', () => {
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, {
propsData: {
store,
......
......@@ -8,7 +8,7 @@ describe('Deploy keys panel', () => {
const findTableRowHeader = () => wrapper.find('.table-row-header');
const mountComponent = props => {
const mountComponent = (props) => {
const store = new DeployKeysStore();
store.keys = data;
wrapper = mount(deployKeysPanel, {
......
......@@ -56,8 +56,8 @@ describe('deprecatedJQueryDropdown', () => {
search: {
fields: ['name'],
},
text: project => project.name_with_namespace || project.name,
id: project => project.id,
text: (project) => project.name_with_namespace || project.name,
id: (project) => project.id,
...extraOpts,
};
test.dropdownButtonElement = $('#js-project-dropdown', test.dropdownContainerElement);
......
......@@ -108,7 +108,7 @@ describe('Design discussions component', () => {
it('renders correct amount of discussion notes', () => {
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', () => {
......@@ -251,7 +251,7 @@ describe('Design discussions component', () => {
describe('when any note from a discussion is active', () => {
it.each([notes[0], notes[0].discussion.notes.nodes[1]])(
'applies correct class to all notes in the active discussion',
note => {
(note) => {
createComponent(
{ discussion: mockDiscussion },
{
......@@ -265,7 +265,7 @@ describe('Design discussions component', () => {
expect(
wrapper
.findAll(DesignNote)
.wrappers.every(designNote => designNote.classes('gl-bg-blue-50')),
.wrappers.every((designNote) => designNote.classes('gl-bg-blue-50')),
).toBe(true);
},
);
......
......@@ -13,7 +13,7 @@ describe('Design overlay component', () => {
const findAllNotes = () => wrapper.findAll('.js-image-badge');
const findCommentBadge = () => wrapper.find('.comment-indicator');
const findBadgeAtIndex = noteIndex => findAllNotes().at(noteIndex);
const findBadgeAtIndex = (noteIndex) => findAllNotes().at(noteIndex);
const findFirstBadge = () => findBadgeAtIndex(0);
const findSecondBadge = () => findBadgeAtIndex(1);
......@@ -108,7 +108,7 @@ describe('Design overlay component', () => {
describe('when no discussion is active', () => {
it('should not apply inactive class to any pins', () => {
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);
});
});
......@@ -116,7 +116,7 @@ describe('Design overlay component', () => {
describe('when a discussion is active', () => {
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',
note => {
(note) => {
wrapper.setData({
activeDiscussion: {
id: note.id,
......
......@@ -10,7 +10,7 @@ describe('Design management design scaler component', () => {
const getResetScaleButton = () => getButtons().at(1);
const getIncreaseScaleButton = () => getButtons().at(2);
const setScale = scale => wrapper.vm.setScale(scale);
const setScale = (scale) => wrapper.vm.setScale(scale);
const createComponent = () => {
wrapper = shallowMount(DesignScaler);
......
......@@ -6,7 +6,7 @@ import mockAllVersions from './mock_data/all_versions';
const LATEST_VERSION_ID = 3;
const PREVIOUS_VERSION_ID = 2;
const designRouteFactory = versionId => ({
const designRouteFactory = (versionId) => ({
path: `/designs?version=${versionId}`,
query: {
version: `${versionId}`,
......@@ -42,7 +42,7 @@ describe('Design management design version dropdown component', () => {
wrapper.destroy();
});
const findVersionLink = index => wrapper.findAll(GlDropdownItem).at(index);
const findVersionLink = (index) => wrapper.findAll(GlDropdownItem).at(index);
it('renders design version dropdown button', () => {
createComponent();
......
......@@ -572,7 +572,7 @@ describe('Design management index page', () => {
return wrapper.vm.$nextTick().then(() => {
expect(findDeleteButton().props().hasSelectedDesigns).toBe(true);
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', () => {
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', () => {
const wrapper = factory(routeArg);
......@@ -50,7 +50,7 @@ describe('Design management router', () => {
describe.each([['/designs/1'], [{ name: DESIGN_ROUTE_NAME, params: { id: '1' } }]])(
'designs detail route',
routeArg => {
(routeArg) => {
it('pushes designs detail component', () => {
const wrapper = factory(routeArg);
......
......@@ -3,7 +3,7 @@ import {
designUploadSkippedWarning,
} from '~/design_management/utils/error_messages';
const mockFilenames = n =>
const mockFilenames = (n) =>
Array(n)
.fill(0)
.map((_, i) => ({ filename: `${i + 1}.jpg` }));
......@@ -14,7 +14,7 @@ describe('Error message', () => {
const pluralMsg = 'Could not archive designs. Please try again.';
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);
});
});
......
......@@ -102,13 +102,13 @@ describe('diffs/components/app', () => {
});
describe('fetch diff methods', () => {
beforeEach(done => {
beforeEach((done) => {
const fetchResolver = () => {
store.state.diffs.retrievingBatches = false;
store.state.notes.discussions = 'test';
return Promise.resolve({ real_size: 100 });
};
jest.spyOn(window, 'requestIdleCallback').mockImplementation(fn => fn());
jest.spyOn(window, 'requestIdleCallback').mockImplementation((fn) => fn());
createComponent();
jest.spyOn(wrapper.vm, 'fetchDiffFilesMeta').mockImplementation(fetchResolver);
jest.spyOn(wrapper.vm, 'fetchDiffFilesBatch').mockImplementation(fetchResolver);
......@@ -122,7 +122,7 @@ describe('diffs/components/app', () => {
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);
wrapper.vm.isLatestVersion = () => false;
wrapper.vm.fetchData(false);
......@@ -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);
wrapper.vm.fetchData(false);
......@@ -216,7 +216,7 @@ describe('diffs/components/app', () => {
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({
shouldShow: true,
});
......@@ -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({
shouldShow: true,
});
......@@ -439,7 +439,7 @@ describe('diffs/components/app', () => {
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
.$nextTick()
.then(() => {
......@@ -459,7 +459,7 @@ describe('diffs/components/app', () => {
.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
.$nextTick()
.then(() => {
......@@ -476,7 +476,7 @@ describe('diffs/components/app', () => {
.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
.$nextTick()
.then(() => {
......
......@@ -31,7 +31,7 @@ describe('CompareDropdownLayout', () => {
const findListItems = () => wrapper.findAll('li');
const findListItemsData = () =>
findListItems().wrappers.map(listItem => ({
findListItems().wrappers.map((listItem) => ({
href: listItem.find('a').attributes('href'),
text: trimText(listItem.text()),
createdAt: listItem.findAll(TimeAgo).wrappers[0]?.props('time'),
......
......@@ -13,7 +13,7 @@ describe('CompareVersions', () => {
let wrapper;
const targetBranchName = 'tmp-wine-dev';
const createWrapper = props => {
const createWrapper = (props) => {
const store = createStore();
const mergeRequestDiff = diffsMockData[0];
......@@ -121,7 +121,7 @@ describe('CompareVersions', () => {
});
describe('commit', () => {
beforeEach(done => {
beforeEach((done) => {
wrapper.vm.$store.state.diffs.commit = getDiffWithCommit().commit;
wrapper.mergeRequestDiffs = [];
......
......@@ -102,7 +102,7 @@ describe('DiffContent', () => {
describe('with text based files', () => {
afterEach(() => {
[isParallelViewGetterMock, isInlineViewGetterMock].forEach(m => m.mockRestore());
[isParallelViewGetterMock, isInlineViewGetterMock].forEach((m) => m.mockRestore());
});
const textDiffFile = { ...defaultProps.diffFile, viewer: { name: diffViewerModes.text } };
......
......@@ -15,7 +15,7 @@ describe('DiffDiscussions', () => {
let wrapper;
const getDiscussionsMockData = () => [{ ...discussionsMockData }];
const createComponent = props => {
const createComponent = (props) => {
store = createStore();
wrapper = mount(localVue.extend(DiffDiscussions), {
store,
......
......@@ -14,7 +14,7 @@ const lineSources = {
[INLINE_DIFF_VIEW_TYPE]: 'highlighted_diff_lines',
};
const lineHandlers = {
[INLINE_DIFF_VIEW_TYPE]: line => line,
[INLINE_DIFF_VIEW_TYPE]: (line) => line,
};
function makeLoadMoreLinesPayload({
......
......@@ -96,13 +96,13 @@ function createComponent({ file, first = false, last = false }) {
};
}
const findDiffHeader = wrapper => wrapper.find(DiffFileHeaderComponent);
const findDiffContentArea = wrapper => wrapper.find('[data-testid="content-area"]');
const findLoader = wrapper => wrapper.find('[data-testid="loader-icon"]');
const findToggleButton = wrapper => wrapper.find('[data-testid="expand-button"]');
const findDiffHeader = (wrapper) => wrapper.find(DiffFileHeaderComponent);
const findDiffContentArea = (wrapper) => wrapper.find('[data-testid="content-area"]');
const findLoader = (wrapper) => wrapper.find('[data-testid="loader-icon"]');
const findToggleButton = (wrapper) => wrapper.find('[data-testid="expand-button"]');
const toggleFile = wrapper => findDiffHeader(wrapper).vm.$emit('toggleFile');
const isDisplayNone = element => element.style.display === 'none';
const toggleFile = (wrapper) => findDiffHeader(wrapper).vm.$emit('toggleFile');
const isDisplayNone = (element) => element.style.display === 'none';
const getReadableFile = () => JSON.parse(JSON.stringify(diffFileMockDataReadable));
const getUnreadableFile = () => JSON.parse(JSON.stringify(diffFileMockDataUnreadable));
......@@ -157,7 +157,7 @@ describe('DiffFile', () => {
await wrapper.vm.$nextTick();
expect(eventHub.$emit).toHaveBeenCalledTimes(events.length);
events.forEach(event => {
events.forEach((event) => {
expect(eventHub.$emit).toHaveBeenCalledWith(event);
});
},
......@@ -174,7 +174,7 @@ describe('DiffFile', () => {
}));
jest.spyOn(wrapper.vm, 'loadCollapsedDiff').mockResolvedValue(getReadableFile());
jest.spyOn(window, 'requestIdleCallback').mockImplementation(fn => fn());
jest.spyOn(window, 'requestIdleCallback').mockImplementation((fn) => fn());
makeFileAutomaticallyCollapsed(store);
......@@ -247,7 +247,7 @@ describe('DiffFile', () => {
it('should not have any content at all', async () => {
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);
});
});
......
......@@ -51,7 +51,7 @@ describe('DiffLineNoteForm', () => {
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(wrapper.vm, 'cancelCommentForm').mockImplementation(() => {});
jest.spyOn(wrapper.vm, 'resetAutoSave').mockImplementation(() => {});
......@@ -72,7 +72,7 @@ describe('DiffLineNoteForm', () => {
});
describe('saveNoteForm', () => {
it('should call saveNote action with proper params', done => {
it('should call saveNote action with proper params', (done) => {
const saveDiffDiscussionSpy = jest
.spyOn(wrapper.vm, 'saveDiffDiscussion')
.mockReturnValue(Promise.resolve());
......
......@@ -39,7 +39,7 @@ describe('diff_stats', () => {
});
describe('line changes', () => {
const findFileLine = name => wrapper.find(name);
const findFileLine = (name) => wrapper.find(name);
it('shows the amount of lines added', () => {
expect(findFileLine('.js-file-addition-line').text()).toBe(TEST_ADDED_LINES.toString());
......@@ -51,10 +51,10 @@ describe('diff_stats', () => {
});
describe('files changes', () => {
const findIcon = name =>
const findIcon = (name) =>
wrapper
.findAll(GlIcon)
.filter(c => c.attributes('name') === name)
.filter((c) => c.attributes('name') === name)
.at(0).element.parentNode;
it('shows amount of file changed with plural "files" when 0 files has changed', () => {
......
......@@ -11,7 +11,7 @@ describe('DiffView', () => {
const DiffRow = { template: `<div/>` };
const DiffCommentCell = { template: `<div/>` };
const DraftNote = { template: `<div/>` };
const createWrapper = props => {
const createWrapper = (props) => {
const localVue = createLocalVue();
localVue.use(Vuex);
......
......@@ -114,7 +114,7 @@ describe('Diffs image diff overlay component', () => {
describe('comment form', () => {
const getCommentIndicator = () => wrapper.find('.comment-indicator');
beforeEach(() => {
createComponent({ canComment: true }, store => {
createComponent({ canComment: true }, (store) => {
store.state.diffs.commentForms.push({
fileHash: 'ABC',
x: 20,
......
......@@ -28,7 +28,7 @@ describe('Diff no changes empty state', () => {
});
it('prevents XSS', () => {
createComponent(store => {
createComponent((store) => {
// eslint-disable-next-line no-param-reassign
store.state.notes.noteableData = {
source_branch: '<script>alert("test");</script>',
......
......@@ -40,7 +40,7 @@ describe('ParallelDiffTableRow', () => {
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()
.then(() => {
expect(vm.$el.querySelector('.line_content.right-side').classList).not.toContain('hll');
......@@ -49,7 +49,7 @@ describe('ParallelDiffTableRow', () => {
.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()
.then(() => {
vm.$store.state.diffs.highlightedRow = rightLine.line_code;
......@@ -86,7 +86,7 @@ describe('ParallelDiffTableRow', () => {
}).$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()
.then(() => {
expect(vm.$el.querySelector('.line_content.right-side').classList).not.toContain('hll');
......@@ -96,7 +96,7 @@ describe('ParallelDiffTableRow', () => {
.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()
.then(() => {
vm.$store.state.diffs.highlightedRow = rightLine.line_code;
......@@ -112,7 +112,7 @@ describe('ParallelDiffTableRow', () => {
});
describe('sets coverage title and class', () => {
it('for lines with coverage', done => {
it('for lines with coverage', (done) => {
vm.$nextTick()
.then(() => {
const name = diffFileMockData.file_path;
......@@ -132,7 +132,7 @@ describe('ParallelDiffTableRow', () => {
.catch(done.fail);
});
it('for lines without coverage', done => {
it('for lines without coverage', (done) => {
vm.$nextTick()
.then(() => {
const name = diffFileMockData.file_path;
......@@ -152,7 +152,7 @@ describe('ParallelDiffTableRow', () => {
.catch(done.fail);
});
it('for unknown lines', done => {
it('for unknown lines', (done) => {
vm.$nextTick()
.then(() => {
vm.$store.state.diffs.coverageFiles = {};
......
......@@ -73,7 +73,7 @@ describe('Diff settings dropdown component', () => {
});
it('sets list button as selected when renderTreeList is false', () => {
createComponent(store => {
createComponent((store) => {
Object.assign(store.state.diffs, {
renderTreeList: false,
});
......@@ -84,7 +84,7 @@ describe('Diff settings dropdown component', () => {
});
it('sets tree button as selected when renderTreeList is true', () => {
createComponent(store => {
createComponent((store) => {
Object.assign(store.state.diffs, {
renderTreeList: true,
});
......@@ -97,7 +97,7 @@ describe('Diff settings dropdown component', () => {
describe('compare changes', () => {
it('sets inline button as selected', () => {
createComponent(store => {
createComponent((store) => {
Object.assign(store.state.diffs, {
diffViewType: INLINE_DIFF_VIEW_TYPE,
});
......@@ -108,7 +108,7 @@ describe('Diff settings dropdown component', () => {
});
it('sets parallel button as selected', () => {
createComponent(store => {
createComponent((store) => {
Object.assign(store.state.diffs, {
diffViewType: PARALLEL_DIFF_VIEW_TYPE,
});
......@@ -137,7 +137,7 @@ describe('Diff settings dropdown component', () => {
describe('whitespace toggle', () => {
it('does not set as checked when showWhitespace is false', () => {
createComponent(store => {
createComponent((store) => {
Object.assign(store.state.diffs, {
showWhitespace: false,
});
......@@ -147,7 +147,7 @@ describe('Diff settings dropdown component', () => {
});
it('sets as checked when showWhitespace is true', () => {
createComponent(store => {
createComponent((store) => {
Object.assign(store.state.diffs, {
showWhitespace: true,
});
......@@ -183,7 +183,7 @@ describe('Diff settings dropdown component', () => {
`(
'sets the checkbox to { checked: $checked } if the fileByFile setting is $fileByFile',
async ({ fileByFile, checked }) => {
createComponent(store => {
createComponent((store) => {
Object.assign(store.state.diffs, {
viewDiffsFileByFile: fileByFile,
});
......@@ -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',
async ({ start, emit }) => {
createComponent(store => {
createComponent((store) => {
Object.assign(store.state.diffs, {
viewDiffsFileByFile: start,
});
......
This diff is collapsed.
......@@ -49,7 +49,7 @@ describe('Compare diff version dropdowns', () => {
let expectedHeadVersion;
const originalLocation = window.location;
const setupTest = includeDiffHeadParam => {
const setupTest = (includeDiffHeadParam) => {
const diffHeadParam = includeDiffHeadParam ? '?diff_head=true' : '';
Object.defineProperty(window, 'location', {
......@@ -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
const targetBaseVersion = targetVersions[targetVersions.length - 2];
const targetHeadVersion = targetVersions[targetVersions.length - 1];
......
......@@ -481,7 +481,7 @@ describe('DiffsStoreUtils', () => {
});
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 }));
});
});
......@@ -492,9 +492,9 @@ describe('DiffsStoreUtils', () => {
...splitInlineDiff.diff_files,
...splitParallelDiff.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);
});
});
......@@ -560,7 +560,7 @@ describe('DiffsStoreUtils', () => {
});
it('adds the `.brokenSymlink` property to each meta diff file', () => {
preparedDiffFiles.forEach(file => {
preparedDiffFiles.forEach((file) => {
expect(file).toMatchObject({ brokenSymlink: false });
});
});
......
......@@ -32,7 +32,7 @@ describe('UUIDs Util', () => {
const ids = uuids({ count: 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`
......
import DirtySubmitCollection from '~/dirty_submit/dirty_submit_collection';
import { setInputValue, createForm } from './helper';
jest.mock('lodash/throttle', () => jest.fn(fn => fn));
jest.mock('lodash/throttle', () => jest.fn((fn) => fn));
describe('DirtySubmitCollection', () => {
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
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 originalValue = input.value;
......
......@@ -2,7 +2,7 @@ import { range as rge, throttle } from 'lodash';
import DirtySubmitForm from '~/dirty_submit/dirty_submit_form';
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');
function expectToToggleDisableOnDirtyUpdate(submit, input) {
......@@ -66,7 +66,7 @@ describe('DirtySubmitForm', () => {
const { form, input } = createForm();
const updateDirtyInputSpy = jest.spyOn(new DirtySubmitForm(form), 'updateDirtyInput');
rge(10).forEach(i => {
rge(10).forEach((i) => {
setInputValue(input, `change ${i}`, false);
});
......@@ -78,13 +78,13 @@ describe('DirtySubmitForm', () => {
it('does not throttle updates when rapid changes are made to different form elements', () => {
const form = document.createElement('form');
const range = rge(10);
range.forEach(i => {
range.forEach((i) => {
form.innerHTML += `<input type="text" name="input-${i}" class="js-input-${i}"/>`;
});
const updateDirtyInputSpy = jest.spyOn(new DirtySubmitForm(form), 'updateDirtyInput');
range.forEach(i => {
range.forEach((i) => {
const input = form.querySelector(`.js-input-${i}`);
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