Commit 0edd1b14 authored by Mike Greiling's avatar Mike Greiling

Merge branch 'jivanvl-replace-underscore-lodash-spec-javascripts' into 'master'

Replace underscore for lodash in spec/javascripts

See merge request gitlab-org/gitlab!26942
parents 0cfb4ae0 64e15411
/* eslint-disable no-new */ /* eslint-disable no-new */
import _ from 'underscore'; import { clone } from 'lodash';
import MockAdapter from 'axios-mock-adapter'; import MockAdapter from 'axios-mock-adapter';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import Sidebar from '~/right_sidebar'; import Sidebar from '~/right_sidebar';
...@@ -24,13 +24,13 @@ describe('Issuable right sidebar collapsed todo toggle', () => { ...@@ -24,13 +24,13 @@ describe('Issuable right sidebar collapsed todo toggle', () => {
mock = new MockAdapter(axios); mock = new MockAdapter(axios);
mock.onPost(`${gl.TEST_HOST}/frontend-fixtures/issues-project/todos`).reply(() => { mock.onPost(`${gl.TEST_HOST}/frontend-fixtures/issues-project/todos`).reply(() => {
const response = _.clone(todoData); const response = clone(todoData);
return [200, response]; return [200, response];
}); });
mock.onDelete(/(.*)\/dashboard\/todos\/\d+$/).reply(() => { mock.onDelete(/(.*)\/dashboard\/todos\/\d+$/).reply(() => {
const response = _.clone(todoData); const response = clone(todoData);
delete response.delete_path; delete response.delete_path;
return [200, response]; return [200, response];
......
import _ from 'underscore'; import { range as rge } 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';
...@@ -82,7 +82,7 @@ describe('DirtySubmitForm', () => { ...@@ -82,7 +82,7 @@ describe('DirtySubmitForm', () => {
const { form, input } = createForm(); const { form, input } = createForm();
const updateDirtyInputSpy = spyOn(new DirtySubmitForm(form), 'updateDirtyInput'); const updateDirtyInputSpy = spyOn(new DirtySubmitForm(form), 'updateDirtyInput');
_.range(10).forEach(i => { rge(10).forEach(i => {
setInputValue(input, `change ${i}`, false); setInputValue(input, `change ${i}`, false);
}); });
...@@ -93,7 +93,7 @@ describe('DirtySubmitForm', () => { ...@@ -93,7 +93,7 @@ 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 = _.range(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}"/>`;
}); });
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
import $ from 'jquery'; import $ from 'jquery';
import MockAdapter from 'axios-mock-adapter'; import MockAdapter from 'axios-mock-adapter';
import _ from 'underscore'; import { shuffle } from 'lodash';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import IssuableContext from '~/issuable_context'; import IssuableContext from '~/issuable_context';
import LabelsSelect from '~/labels_select'; import LabelsSelect from '~/labels_select';
...@@ -27,7 +27,7 @@ function testLabelClicks(labelOrder, done) { ...@@ -27,7 +27,7 @@ function testLabelClicks(labelOrder, done) {
expect(labelsInDropdown.length).toBe(10); expect(labelsInDropdown.length).toBe(10);
const arrayOfLabels = labelsInDropdown.get(); const arrayOfLabels = labelsInDropdown.get();
const randomArrayOfLabels = _.shuffle(arrayOfLabels); const randomArrayOfLabels = shuffle(arrayOfLabels);
randomArrayOfLabels.forEach((label, i) => { randomArrayOfLabels.forEach((label, i) => {
if (i < saveLabelCount) { if (i < saveLabelCount) {
$(label).click(); $(label).click();
......
import _ from 'underscore'; import { range as rge } from 'lodash';
import Vue from 'vue'; import Vue from 'vue';
import { mountComponentWithStore } from 'spec/helpers/vue_mount_component_helper'; import { mountComponentWithStore } from 'spec/helpers/vue_mount_component_helper';
import app from '~/releases/components/app_index.vue'; import app from '~/releases/components/app_index.vue';
...@@ -28,7 +28,7 @@ describe('Releases App ', () => { ...@@ -28,7 +28,7 @@ describe('Releases App ', () => {
beforeEach(() => { beforeEach(() => {
store = createStore({ modules: { list: listModule } }); store = createStore({ modules: { list: listModule } });
releasesPagination = _.range(21).map(index => ({ releasesPagination = rge(21).map(index => ({
...convertObjectPropsToCamelCase(release, { deep: true }), ...convertObjectPropsToCamelCase(release, { deep: true }),
tagName: `${index}.00`, tagName: `${index}.00`,
})); }));
......
import $ from 'jquery'; import $ from 'jquery';
import _ from 'underscore'; import { assignIn } from 'lodash';
import waitForPromises from 'spec/helpers/wait_for_promises'; import waitForPromises from 'spec/helpers/wait_for_promises';
import SmartInterval from '~/smart_interval'; import SmartInterval from '~/smart_interval';
...@@ -21,7 +21,7 @@ describe('SmartInterval', function() { ...@@ -21,7 +21,7 @@ describe('SmartInterval', function() {
}; };
if (config) { if (config) {
_.extend(defaultParams, config); assignIn(defaultParams, config);
} }
return new SmartInterval(defaultParams); return new SmartInterval(defaultParams);
......
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