Commit e3aca8c8 authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 33 files - 53 of 73

Part of our prettier migration; changing the arrow-parens style.
parent 3b1593f2
......@@ -1531,41 +1531,6 @@ ee/spec/frontend/roadmap/components/epic_item_timeline_spec.js
ee/spec/frontend/roadmap/components/epics_list_empty_spec.js
ee/spec/frontend/roadmap/components/milestones_list_section_spec.js
## relaxed-goldwasser
spec/frontend/__mocks__/@gitlab/ui.js
spec/frontend/__mocks__/lodash/debounce.js
spec/frontend/__mocks__/lodash/throttle.js
spec/frontend/activities_spec.js
spec/frontend/add_context_commits_modal/store/actions_spec.js
spec/frontend/admin/statistics_panel/components/app_spec.js
spec/frontend/admin/statistics_panel/store/actions_spec.js
spec/frontend/alert_handler_spec.js
spec/frontend/alerts_service_settings/components/alerts_service_form_spec.js
spec/frontend/alerts_settings/alert_mapping_builder_spec.js
spec/frontend/alerts_settings/alerts_settings_wrapper_spec.js
spec/frontend/analytics/instance_statistics/components/app_spec.js
spec/frontend/api_spec.js
spec/frontend/authentication/two_factor_auth/components/recovery_codes_spec.js
spec/frontend/authentication/u2f/authenticate_spec.js
spec/frontend/authentication/u2f/register_spec.js
spec/frontend/awards_handler_spec.js
spec/frontend/badges/components/badge_form_spec.js
spec/frontend/badges/components/badge_list_row_spec.js
spec/frontend/badges/components/badge_list_spec.js
spec/frontend/badges/components/badge_spec.js
spec/frontend/badges/store/actions_spec.js
spec/frontend/batch_comments/components/draft_note_spec.js
spec/frontend/batch_comments/components/drafts_count_spec.js
spec/frontend/batch_comments/components/preview_item_spec.js
spec/frontend/batch_comments/components/publish_button_spec.js
spec/frontend/batch_comments/stores/modules/batch_comments/actions_spec.js
spec/frontend/behaviors/autosize_spec.js
spec/frontend/behaviors/copy_as_gfm_spec.js
spec/frontend/behaviors/load_startup_css_spec.js
spec/frontend/behaviors/markdown/paste_markdown_table_spec.js
spec/frontend/behaviors/quick_submit_spec.js
spec/frontend/behaviors/secret_values_spec.js
## eager-lamport
spec/frontend/behaviors/shortcuts/keybindings_spec.js
spec/frontend/behaviors/shortcuts/shortcuts_issuable_spec.js
......
......@@ -38,7 +38,7 @@ jest.mock('@gitlab/ui/dist/components/base/popover/popover.js', () => ({
required: false,
default: () => [],
},
...Object.fromEntries(['target', 'triggers', 'placement'].map(prop => [prop, {}])),
...Object.fromEntries(['target', 'triggers', 'placement'].map((prop) => [prop, {}])),
},
render(h) {
return h(
......@@ -47,7 +47,7 @@ jest.mock('@gitlab/ui/dist/components/base/popover/popover.js', () => ({
class: 'gl-popover',
...this.$attrs,
},
Object.keys(this.$slots).map(s => this.$slots[s]),
Object.keys(this.$slots).map((s) => this.$slots[s]),
);
},
}));
......@@ -8,7 +8,7 @@
// [2]: https://gitlab.com/gitlab-org/gitlab/-/issues/213378
// Further reference: https://github.com/facebook/jest/issues/3465
export default fn => {
export default (fn) => {
const debouncedFn = jest.fn().mockImplementation(fn);
debouncedFn.cancel = jest.fn();
debouncedFn.flush = jest.fn().mockImplementation(() => {
......
// Similar to `lodash/debounce`, `lodash/throttle` also causes flaky specs.
// See `./debounce.js` for more details.
export default fn => fn;
export default (fn) => fn;
......@@ -44,14 +44,14 @@ describe('Activities', () => {
});
for (let i = 0; i < filters.length; i += 1) {
(i => {
((i) => {
describe(`when selecting ${getEventName(i)}`, () => {
beforeEach(() => {
$(getSelector(i)).click();
});
for (let x = 0; x < filters.length; x += 1) {
(x => {
((x) => {
const shouldHighlight = i === x;
const testName = shouldHighlight ? 'should highlight' : 'should not highlight';
......
......@@ -42,7 +42,7 @@ describe('AddContextCommitsModalStoreActions', () => {
});
describe('setBaseConfig', () => {
it('commits SET_BASE_CONFIG', done => {
it('commits SET_BASE_CONFIG', (done) => {
const options = { contextCommitsPath, mergeRequestIid, projectId };
testAction(
setBaseConfig,
......@@ -65,7 +65,7 @@ describe('AddContextCommitsModalStoreActions', () => {
});
describe('setTabIndex', () => {
it('commits SET_TABINDEX', done => {
it('commits SET_TABINDEX', (done) => {
testAction(
setTabIndex,
{ tabIndex: 1 },
......@@ -78,7 +78,7 @@ describe('AddContextCommitsModalStoreActions', () => {
});
describe('setCommits', () => {
it('commits SET_COMMITS', done => {
it('commits SET_COMMITS', (done) => {
testAction(
setCommits,
{ commits: [], silentAddition: false },
......@@ -89,7 +89,7 @@ describe('AddContextCommitsModalStoreActions', () => {
);
});
it('commits SET_COMMITS_SILENT', done => {
it('commits SET_COMMITS_SILENT', (done) => {
testAction(
setCommits,
{ commits: [], silentAddition: true },
......@@ -102,7 +102,7 @@ describe('AddContextCommitsModalStoreActions', () => {
});
describe('createContextCommits', () => {
it('calls API to create context commits', done => {
it('calls API to create context commits', (done) => {
mock.onPost(contextCommitEndpoint).reply(200, {});
testAction(createContextCommits, { commits: [] }, {}, [], [], done);
......@@ -126,7 +126,7 @@ describe('AddContextCommitsModalStoreActions', () => {
)
.reply(200, [dummyCommit]);
});
it('commits FETCH_CONTEXT_COMMITS', done => {
it('commits FETCH_CONTEXT_COMMITS', (done) => {
const contextCommit = { ...dummyCommit, isSelected: true };
testAction(
fetchContextCommits,
......@@ -150,7 +150,7 @@ describe('AddContextCommitsModalStoreActions', () => {
});
describe('setContextCommits', () => {
it('commits SET_CONTEXT_COMMITS', done => {
it('commits SET_CONTEXT_COMMITS', (done) => {
testAction(
setContextCommits,
{ data: [] },
......@@ -168,7 +168,7 @@ describe('AddContextCommitsModalStoreActions', () => {
.onDelete('/api/v4/projects/gitlab-org%2Fgitlab/merge_requests/1/context_commits')
.reply(204);
});
it('calls API to remove context commits', done => {
it('calls API to remove context commits', (done) => {
testAction(
removeContextCommits,
{ forceReload: false },
......@@ -181,7 +181,7 @@ describe('AddContextCommitsModalStoreActions', () => {
});
describe('setSelectedCommits', () => {
it('commits SET_SELECTED_COMMITS', done => {
it('commits SET_SELECTED_COMMITS', (done) => {
testAction(
setSelectedCommits,
[dummyCommit],
......@@ -194,7 +194,7 @@ describe('AddContextCommitsModalStoreActions', () => {
});
describe('setSearchText', () => {
it('commits SET_SEARCH_TEXT', done => {
it('commits SET_SEARCH_TEXT', (done) => {
const searchText = 'Dummy Text';
testAction(
setSearchText,
......@@ -208,7 +208,7 @@ describe('AddContextCommitsModalStoreActions', () => {
});
describe('setToRemoveCommits', () => {
it('commits SET_TO_REMOVE_COMMITS', done => {
it('commits SET_TO_REMOVE_COMMITS', (done) => {
const commitId = 'abcde';
testAction(
......@@ -223,7 +223,7 @@ describe('AddContextCommitsModalStoreActions', () => {
});
describe('resetModalState', () => {
it('commits RESET_MODAL_STATE', done => {
it('commits RESET_MODAL_STATE', (done) => {
const commitId = 'abcde';
testAction(
......
......@@ -34,7 +34,7 @@ describe('Admin statistics app', () => {
wrapper.destroy();
});
const findStats = idx => wrapper.findAll('.js-stats').at(idx);
const findStats = (idx) => wrapper.findAll('.js-stats').at(idx);
describe('template', () => {
describe('when app is loading', () => {
......
......@@ -22,7 +22,7 @@ describe('Admin statistics panel actions', () => {
mock.onGet(/api\/(.*)\/application\/statistics/).replyOnce(200, mockStatistics);
});
it('dispatches success with received data', done =>
it('dispatches success with received data', (done) =>
testAction(
actions.fetchStatistics,
null,
......@@ -46,7 +46,7 @@ describe('Admin statistics panel actions', () => {
mock.onGet(/api\/(.*)\/application\/statistics/).replyOnce(500);
});
it('dispatches error', done =>
it('dispatches error', (done) =>
testAction(
actions.fetchStatistics,
null,
......@@ -67,7 +67,7 @@ describe('Admin statistics panel actions', () => {
});
describe('requestStatistic', () => {
it('should commit the request mutation', done =>
it('should commit the request mutation', (done) =>
testAction(
actions.requestStatistics,
null,
......@@ -79,7 +79,7 @@ describe('Admin statistics panel actions', () => {
});
describe('receiveStatisticsSuccess', () => {
it('should commit received data', done =>
it('should commit received data', (done) =>
testAction(
actions.receiveStatisticsSuccess,
mockStatistics,
......@@ -96,7 +96,7 @@ describe('Admin statistics panel actions', () => {
});
describe('receiveStatisticsError', () => {
it('should commit error', done => {
it('should commit error', (done) => {
testAction(
actions.receiveStatisticsError,
500,
......
......@@ -7,7 +7,7 @@ describe('Alert Handler', () => {
const DISMISS_CLASS = 'gl-alert-dismiss';
const DISMISS_LABEL = 'Dismiss';
const generateHtml = parentClass =>
const generateHtml = (parentClass) =>
`<div class="${parentClass}">
<button aria-label="${DISMISS_LABEL}">Dismiss</button>
</div>`;
......
......@@ -35,7 +35,7 @@ describe('AlertsServiceForm', () => {
const findUrl = () => wrapper.find('#url');
const findAuthorizationKey = () => wrapper.find('#authorization-key');
const findDescription = () => wrapper.find('[data-testid="description"');
const findActiveStatusIcon = val =>
const findActiveStatusIcon = (val) =>
document.querySelector(`.js-service-active-status[data-value=${val.toString()}]`);
beforeEach(() => {
......
......@@ -63,7 +63,7 @@ describe('AlertMappingBuilder', () => {
const dropdownItems = dropdown.findAll(GlDropdownItem);
const { nodes } = parsedMapping.samplePayload.payloadAlerFields;
const numberOfMappingOptions = nodes.filter(({ type }) =>
type.some(t => compatibleTypes.includes(t)),
type.some((t) => compatibleTypes.includes(t)),
);
expect(dropdown.exists()).toBe(true);
......@@ -82,7 +82,7 @@ describe('AlertMappingBuilder', () => {
const dropdownItems = dropdown.findAll(GlDropdownItem);
const { nodes } = parsedMapping.samplePayload.payloadAlerFields;
const numberOfMappingOptions = nodes.filter(({ type }) =>
type.some(t => compatibleTypes.includes(t)),
type.some((t) => compatibleTypes.includes(t)),
);
expect(searchBox.exists()).toBe(Boolean(numberOfFallbacks));
......
......@@ -379,7 +379,7 @@ describe('AlertsSettingsWrapper', () => {
// TODO: Will be removed in 13.7 as part of: https://gitlab.com/gitlab-org/gitlab/-/issues/273657
describe('Opsgenie integration', () => {
it.each([true, false])('it shows/hides the alert when opsgenie is %s', active => {
it.each([true, false])('it shows/hides the alert when opsgenie is %s', (active) => {
createComponent({
data: { integrations: { list: mockIntegrations }, currentIntegration: mockIntegrations[0] },
provide: { opsgenie: { active } },
......
......@@ -25,11 +25,11 @@ describe('InstanceStatisticsApp', () => {
expect(wrapper.find(InstanceCounts).exists()).toBe(true);
});
['Pipelines', 'Issues & Merge Requests'].forEach(instance => {
['Pipelines', 'Issues & Merge Requests'].forEach((instance) => {
it(`displays the ${instance} chart`, () => {
const chartTitles = wrapper
.findAll(InstanceStatisticsCountChart)
.wrappers.map(chartComponent => chartComponent.props('chartTitle'));
.wrappers.map((chartComponent) => chartComponent.props('chartTitle'));
expect(chartTitles).toContain(instance);
});
......
This diff is collapsed.
......@@ -34,8 +34,8 @@ describe('RecoveryCodes', () => {
const findAlert = () => wrapper.find(GlAlert);
const findRecoveryCodes = () => wrapper.findByTestId('recovery-codes');
const findCopyButton = () => wrapper.find(ClipboardButton);
const findButtonByText = text =>
wrapper.findAll(GlButton).wrappers.find(buttonWrapper => buttonWrapper.text() === text);
const findButtonByText = (text) =>
wrapper.findAll(GlButton).wrappers.find((buttonWrapper) => buttonWrapper.text() === text);
const findDownloadButton = () => findButtonByText('Download codes');
const findPrintButton = () => findButtonByText('Print codes');
const findProceedButton = () => findButtonByText('Proceed');
......@@ -59,7 +59,7 @@ describe('RecoveryCodes', () => {
it('renders codes', () => {
const recoveryCodes = findRecoveryCodes().text();
codes.forEach(code => {
codes.forEach((code) => {
expect(recoveryCodes).toContain(code);
});
});
......
......@@ -38,7 +38,7 @@ describe('U2FAuthenticate', () => {
window.u2f = oldu2f;
});
it('falls back to normal 2fa', done => {
it('falls back to normal 2fa', (done) => {
component
.start()
.then(() => {
......@@ -50,7 +50,7 @@ describe('U2FAuthenticate', () => {
});
describe('with u2f available', () => {
beforeEach(done => {
beforeEach((done) => {
// bypass automatic form submission within renderAuthenticated
jest.spyOn(component, 'renderAuthenticated').mockReturnValue(true);
u2fDevice = new MockU2FDevice();
......
......@@ -10,7 +10,7 @@ describe('U2FRegister', () => {
preloadFixtures('u2f/register.html');
beforeEach(done => {
beforeEach((done) => {
loadFixtures('u2f/register.html');
u2fDevice = new MockU2FDevice();
container = $('#js-register-token-2fa');
......
......@@ -63,7 +63,7 @@ describe('AwardsHandler', () => {
const $menu = $('.emoji-menu');
return new Promise(resolve => {
return new Promise((resolve) => {
$menu.one('build-emoji-menu-finish', () => {
resolve();
});
......@@ -356,7 +356,7 @@ describe('AwardsHandler', () => {
await openAndWaitForEmojiMenu();
const emojiMenu = document.querySelector('.emoji-menu');
Array.prototype.forEach.call(emojiMenu.querySelectorAll('.emoji-menu-title'), title => {
Array.prototype.forEach.call(emojiMenu.querySelectorAll('.emoji-menu-title'), (title) => {
expect(title.textContent.trim().toLowerCase()).not.toBe('frequently used');
});
});
......@@ -369,7 +369,7 @@ describe('AwardsHandler', () => {
const emojiMenu = document.querySelector('.emoji-menu');
const hasFrequentlyUsedHeading = Array.prototype.some.call(
emojiMenu.querySelectorAll('.emoji-menu-title'),
title => title.textContent.trim().toLowerCase() === 'frequently used',
(title) => title.textContent.trim().toLowerCase() === 'frequently used',
);
expect(hasFrequentlyUsedHeading).toBe(true);
......
......@@ -50,7 +50,7 @@ describe('BadgeForm component', () => {
});
});
const sharedSubmitTests = submitAction => {
const sharedSubmitTests = (submitAction) => {
const nameSelector = '#badge-name';
const imageUrlSelector = '#badge-image-url';
const findImageUrlElement = () => vm.$el.querySelector(imageUrlSelector);
......@@ -65,7 +65,7 @@ describe('BadgeForm component', () => {
const submitButton = vm.$el.querySelector('button[type="submit"]');
submitButton.click();
};
const expectInvalidInput = inputElementSelector => {
const expectInvalidInput = (inputElementSelector) => {
const inputElement = vm.$el.querySelector(inputElementSelector);
expect(inputElement.checkValidity()).toBe(false);
......@@ -74,7 +74,7 @@ describe('BadgeForm component', () => {
expect(feedbackElement).toBeVisible();
};
beforeEach(done => {
beforeEach((done) => {
jest.spyOn(vm, submitAction).mockReturnValue(Promise.resolve());
store.replaceState({
...store.state,
......
......@@ -73,7 +73,7 @@ describe('BadgeListRow component', () => {
expect(vm.editBadge).toHaveBeenCalled();
});
it('calls updateBadgeInModal and shows modal when clicking then delete button', done => {
it('calls updateBadgeInModal and shows modal when clicking then delete button', (done) => {
jest.spyOn(vm, 'updateBadgeInModal').mockImplementation(() => {});
const deleteButton = vm.$el.querySelector('.table-button-footer button:last-of-type');
......@@ -88,7 +88,7 @@ describe('BadgeListRow component', () => {
});
describe('for a group badge', () => {
beforeEach(done => {
beforeEach((done) => {
badge.kind = GROUP_BADGE;
Vue.nextTick().then(done).catch(done.fail);
......
......@@ -48,7 +48,7 @@ describe('BadgeList component', () => {
expect(rows).toHaveLength(numberOfDummyBadges);
});
it('renders a message if no badges exist', done => {
it('renders a message if no badges exist', (done) => {
store.state.badges = [];
Vue.nextTick()
......@@ -59,7 +59,7 @@ describe('BadgeList component', () => {
.catch(done.fail);
});
it('shows a loading icon when loading', done => {
it('shows a loading icon when loading', (done) => {
store.state.isLoading = true;
Vue.nextTick()
......@@ -73,13 +73,13 @@ describe('BadgeList component', () => {
});
describe('for group badges', () => {
beforeEach(done => {
beforeEach((done) => {
store.state.kind = GROUP_BADGE;
Vue.nextTick().then(done).catch(done.fail);
});
it('renders a message if no badges exist', done => {
it('renders a message if no badges exist', (done) => {
store.state.badges = [];
Vue.nextTick()
......
......@@ -23,7 +23,7 @@ describe('Badge component', () => {
const createComponent = (props, el = null) => {
vm = mountComponent(Component, props, el);
const { badgeImage } = findElements();
return new Promise(resolve => {
return new Promise((resolve) => {
badgeImage.addEventListener('load', resolve);
// Manually dispatch load event as it is not triggered
badgeImage.dispatchEvent(new Event('load'));
......@@ -36,7 +36,7 @@ describe('Badge component', () => {
describe('watchers', () => {
describe('imageUrl', () => {
it('sets isLoading and resets numRetries and hasError', done => {
it('sets isLoading and resets numRetries and hasError', (done) => {
const props = { ...dummyProps };
createComponent(props)
.then(() => {
......@@ -60,7 +60,7 @@ describe('Badge component', () => {
});
describe('methods', () => {
beforeEach(done => {
beforeEach((done) => {
createComponent({ ...dummyProps })
.then(done)
.catch(done.fail);
......@@ -98,7 +98,7 @@ describe('Badge component', () => {
});
describe('behavior', () => {
beforeEach(done => {
beforeEach((done) => {
setFixtures('<div id="dummy-element"></div>');
createComponent({ ...dummyProps }, '#dummy-element')
.then(done)
......@@ -116,7 +116,7 @@ describe('Badge component', () => {
expect(vm.$el.querySelector('.btn-group')).toBeHidden();
});
it('shows a loading icon when loading', done => {
it('shows a loading icon when loading', (done) => {
vm.isLoading = true;
Vue.nextTick()
......@@ -132,7 +132,7 @@ describe('Badge component', () => {
.catch(done.fail);
});
it('shows an error and reload button if loading failed', done => {
it('shows an error and reload button if loading failed', (done) => {
vm.hasError = true;
Vue.nextTick()
......
This diff is collapsed.
......@@ -65,7 +65,7 @@ describe('Batch comments draft note component', () => {
);
});
it('sets as loading when draft is publishing', done => {
it('sets as loading when draft is publishing', (done) => {
createComponent();
wrapper.vm.$store.state.batchComments.currentlyPublishingDrafts.push(1);
......@@ -80,7 +80,7 @@ describe('Batch comments draft note component', () => {
});
describe('update', () => {
it('dispatches updateDraft', done => {
it('dispatches updateDraft', (done) => {
createComponent();
const note = wrapper.find(NoteableNote);
......@@ -121,7 +121,7 @@ describe('Batch comments draft note component', () => {
});
describe('quick actions', () => {
it('renders referenced commands', done => {
it('renders referenced commands', (done) => {
createComponent();
wrapper.setProps({
draft: {
......
......@@ -27,7 +27,7 @@ describe('Batch comments drafts count component', () => {
expect(vm.$el.textContent).toContain('1');
});
it('renders screen reader text', done => {
it('renders screen reader text', (done) => {
const el = vm.$el.querySelector('.sr-only');
expect(el.textContent).toContain('draft');
......
......@@ -85,7 +85,7 @@ describe('Batch comments draft preview item component', () => {
describe('for thread', () => {
beforeEach(() => {
createComponent(false, { discussion_id: '1', resolve_discussion: true }, store => {
createComponent(false, { discussion_id: '1', resolve_discussion: true }, (store) => {
store.state.notes.discussions.push({
id: '1',
notes: [
......
......@@ -29,7 +29,7 @@ describe('Batch comments publish button component', () => {
expect(vm.$store.dispatch).toHaveBeenCalledWith('batchComments/publishReview', undefined);
});
it('sets loading when isPublishing is true', done => {
it('sets loading when isPublishing is true', (done) => {
vm.$store.state.batchComments.isPublishing = true;
vm.$nextTick(() => {
......
......@@ -28,7 +28,7 @@ describe('Batch comments store actions', () => {
});
describe('addDraftToDiscussion', () => {
it('commits ADD_NEW_DRAFT if no errors returned', done => {
it('commits ADD_NEW_DRAFT if no errors returned', (done) => {
res = { id: 1 };
mock.onAny().reply(200, res);
......@@ -42,7 +42,7 @@ describe('Batch comments store actions', () => {
);
});
it('does not commit ADD_NEW_DRAFT if errors returned', done => {
it('does not commit ADD_NEW_DRAFT if errors returned', (done) => {
mock.onAny().reply(500);
testAction(
......@@ -57,7 +57,7 @@ describe('Batch comments store actions', () => {
});
describe('createNewDraft', () => {
it('commits ADD_NEW_DRAFT if no errors returned', done => {
it('commits ADD_NEW_DRAFT if no errors returned', (done) => {
res = { id: 1 };
mock.onAny().reply(200, res);
......@@ -71,7 +71,7 @@ describe('Batch comments store actions', () => {
);
});
it('does not commit ADD_NEW_DRAFT if errors returned', done => {
it('does not commit ADD_NEW_DRAFT if errors returned', (done) => {
mock.onAny().reply(500);
testAction(actions.createNewDraft, { endpoint: TEST_HOST, data: 'test' }, null, [], [], done);
......@@ -89,7 +89,7 @@ describe('Batch comments store actions', () => {
};
});
it('commits DELETE_DRAFT if no errors returned', done => {
it('commits DELETE_DRAFT if no errors returned', (done) => {
const commit = jest.fn();
const context = {
getters,
......@@ -107,7 +107,7 @@ describe('Batch comments store actions', () => {
.catch(done.fail);
});
it('does not commit DELETE_DRAFT if errors returned', done => {
it('does not commit DELETE_DRAFT if errors returned', (done) => {
const commit = jest.fn();
const context = {
getters,
......@@ -136,7 +136,7 @@ describe('Batch comments store actions', () => {
};
});
it('commits SET_BATCH_COMMENTS_DRAFTS with returned data', done => {
it('commits SET_BATCH_COMMENTS_DRAFTS with returned data', (done) => {
const commit = jest.fn();
const context = {
getters,
......@@ -170,7 +170,7 @@ describe('Batch comments store actions', () => {
rootGetters = { discussionsStructuredByLineCode: 'discussions' };
});
it('dispatches actions & commits', done => {
it('dispatches actions & commits', (done) => {
mock.onAny().reply(200);
actions
......@@ -185,7 +185,7 @@ describe('Batch comments store actions', () => {
.catch(done.fail);
});
it('dispatches error commits', done => {
it('dispatches error commits', (done) => {
mock.onAny().reply(500);
actions
......@@ -210,7 +210,7 @@ describe('Batch comments store actions', () => {
};
});
it('commits RECEIVE_DRAFT_UPDATE_SUCCESS with returned data', done => {
it('commits RECEIVE_DRAFT_UPDATE_SUCCESS with returned data', (done) => {
const commit = jest.fn();
const context = {
getters,
......@@ -228,7 +228,7 @@ describe('Batch comments store actions', () => {
.catch(done.fail);
});
it('calls passed callback', done => {
it('calls passed callback', (done) => {
const commit = jest.fn();
const context = {
getters,
......@@ -249,7 +249,7 @@ describe('Batch comments store actions', () => {
});
describe('expandAllDiscussions', () => {
it('dispatches expandDiscussion for all drafts', done => {
it('dispatches expandDiscussion for all drafts', (done) => {
const state = {
drafts: [
{
......
......@@ -6,7 +6,7 @@ function load() {
jest.mock('~/helpers/startup_css_helper', () => {
return {
waitForCSSLoaded: jest.fn().mockImplementation(cb => cb.apply()),
waitForCSSLoaded: jest.fn().mockImplementation((cb) => cb.apply()),
};
});
......
......@@ -57,7 +57,7 @@ describe('CopyAsGFM', () => {
const fragment = document.createDocumentFragment();
const node = document.createElement('div');
node.innerHTML = html;
Array.from(node.childNodes).forEach(item => fragment.appendChild(item));
Array.from(node.childNodes).forEach((item) => fragment.appendChild(item));
return fragment;
},
}),
......@@ -80,7 +80,7 @@ describe('CopyAsGFM', () => {
return clipboardData;
};
beforeAll(done => {
beforeAll((done) => {
initCopyAsGFM();
// Fake call to nodeToGfm so the import of lazy bundle happened
......@@ -94,7 +94,7 @@ describe('CopyAsGFM', () => {
beforeEach(() => jest.spyOn(clipboardData, 'setData'));
describe('list handling', () => {
it('uses correct gfm for unordered lists', done => {
it('uses correct gfm for unordered lists', (done) => {
const selection = stubSelection('<li>List Item1</li><li>List Item2</li>\n', 'UL');
window.getSelection = jest.fn(() => selection);
......@@ -108,7 +108,7 @@ describe('CopyAsGFM', () => {
});
});
it('uses correct gfm for ordered lists', done => {
it('uses correct gfm for ordered lists', (done) => {
const selection = stubSelection('<li>List Item1</li><li>List Item2</li>\n', 'OL');
window.getSelection = jest.fn(() => selection);
......@@ -127,7 +127,7 @@ describe('CopyAsGFM', () => {
describe('CopyAsGFM.quoted', () => {
const sampleGFM = '* List 1\n* List 2\n\n`Some code`';
it('adds quote char `> ` to each line', done => {
it('adds quote char `> ` to each line', (done) => {
const expectedQuotedGFM = '> * List 1\n> * List 2\n> \n> `Some code`';
expect(CopyAsGFM.quoted(sampleGFM)).toEqual(expectedQuotedGFM);
done();
......
......@@ -7,7 +7,7 @@ describe('behaviors/load_startup_css', () => {
const setupListeners = () => {
document
.querySelectorAll('link')
.forEach(x => x.addEventListener('load', () => loadListener(x)));
.forEach((x) => x.addEventListener('load', () => loadListener(x)));
};
beforeEach(() => {
......
......@@ -8,7 +8,7 @@ describe('PasteMarkdownTable', () => {
Object.defineProperty(event, 'dataTransfer', {
value: {
getData: jest.fn().mockImplementation(type => {
getData: jest.fn().mockImplementation((type) => {
if (type === 'text/html') {
return '<table><tr><td>First</td><td>Second</td></tr></table>';
}
......@@ -48,7 +48,7 @@ describe('PasteMarkdownTable', () => {
it('returns false when the number of rows are not consistent', () => {
data.types = ['text/html', 'text/plain'];
data.getData = jest.fn().mockImplementation(mimeType => {
data.getData = jest.fn().mockImplementation((mimeType) => {
if (mimeType === 'text/html') {
return '<table><tr><td>def test<td></tr></table>';
}
......@@ -60,7 +60,7 @@ describe('PasteMarkdownTable', () => {
it('returns false when the table copy comes from a diff', () => {
data.types = ['text/html', 'text/plain'];
data.getData = jest.fn().mockImplementation(mimeType => {
data.getData = jest.fn().mockImplementation((mimeType) => {
if (mimeType === 'text/html') {
return '<table class="diff-wrap-lines"><tr><td>First</td><td>Second</td></tr></table>';
}
......@@ -74,7 +74,7 @@ describe('PasteMarkdownTable', () => {
describe('convertToTableMarkdown', () => {
it('returns a Markdown table', () => {
data.types = ['text/html', 'text/plain'];
data.getData = jest.fn().mockImplementation(type => {
data.getData = jest.fn().mockImplementation((type) => {
if (type === 'text/html') {
return '<table><tr><td>First</td><td>Last</td><tr><td>John</td><td>Doe</td><tr><td>Jane</td><td>Doe</td></table>';
} else if (type === 'text/plain') {
......@@ -99,7 +99,7 @@ describe('PasteMarkdownTable', () => {
it('returns a Markdown table with rows normalized', () => {
data.types = ['text/html', 'text/plain'];
data.getData = jest.fn().mockImplementation(type => {
data.getData = jest.fn().mockImplementation((type) => {
if (type === 'text/html') {
return '<table><tr><td>First</td><td>Last</td><tr><td>John</td><td>Doe</td><tr><td>Jane</td><td>/td></table>';
} else if (type === 'text/plain') {
......
......@@ -17,7 +17,7 @@ describe('Quick Submit behavior', () => {
submit: jest.fn(),
};
$('form').submit(e => {
$('form').submit((e) => {
// Prevent a form submit from moving us off the testing page
e.preventDefault();
// Explicitly call the spie to know this function get's not called
......
......@@ -18,7 +18,7 @@ function generateValueMarkup(
function generateFixtureMarkup(secrets, isRevealed, valueClass, placeholderClass) {
return `
<div class="js-secret-container">
${secrets.map(secret => generateValueMarkup(secret, valueClass, placeholderClass)).join('')}
${secrets.map((secret) => generateValueMarkup(secret, valueClass, placeholderClass)).join('')}
<button
class="js-secret-value-reveal-button"
data-secret-reveal-status="${isRevealed}"
......@@ -122,12 +122,12 @@ describe('setupSecretValues', () => {
const placeholders = wrapper.querySelectorAll('.js-secret-value-placeholder');
expect(values.length).toEqual(3);
values.forEach(value => {
values.forEach((value) => {
expect(value.classList.contains('hide')).toEqual(true);
});
expect(placeholders.length).toEqual(3);
placeholders.forEach(placeholder => {
placeholders.forEach((placeholder) => {
expect(placeholder.classList.contains('hide')).toEqual(false);
});
});
......@@ -141,24 +141,24 @@ describe('setupSecretValues', () => {
revealButton.click();
expect(values.length).toEqual(3);
values.forEach(value => {
values.forEach((value) => {
expect(value.classList.contains('hide')).toEqual(false);
});
expect(placeholders.length).toEqual(3);
placeholders.forEach(placeholder => {
placeholders.forEach((placeholder) => {
expect(placeholder.classList.contains('hide')).toEqual(true);
});
revealButton.click();
expect(values.length).toEqual(3);
values.forEach(value => {
values.forEach((value) => {
expect(value.classList.contains('hide')).toEqual(true);
});
expect(placeholders.length).toEqual(3);
placeholders.forEach(placeholder => {
placeholders.forEach((placeholder) => {
expect(placeholder.classList.contains('hide')).toEqual(false);
});
});
......@@ -181,24 +181,24 @@ describe('setupSecretValues', () => {
revealButton.click();
expect(values.length).toEqual(4);
values.forEach(value => {
values.forEach((value) => {
expect(value.classList.contains('hide')).toEqual(false);
});
expect(placeholders.length).toEqual(4);
placeholders.forEach(placeholder => {
placeholders.forEach((placeholder) => {
expect(placeholder.classList.contains('hide')).toEqual(true);
});
revealButton.click();
expect(values.length).toEqual(4);
values.forEach(value => {
values.forEach((value) => {
expect(value.classList.contains('hide')).toEqual(true);
});
expect(placeholders.length).toEqual(4);
placeholders.forEach(placeholder => {
placeholders.forEach((placeholder) => {
expect(placeholder.classList.contains('hide')).toEqual(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