Commit 715a4020 authored by Jose Vargas's avatar Jose Vargas

Replace underscore/lodash in design_management

This replaces all underscore usage for lodash inside
the EE feature design_management
parent 502cdc4a
<script>
import { GlButton, GlModal, GlModalDirective } from '@gitlab/ui';
import _ from 'underscore';
import { uniqueId } from 'lodash';
export default {
name: 'DeleteButton',
......@@ -35,7 +35,7 @@ export default {
},
data() {
return {
modalId: _.uniqueId('design-deletion-confirmation-'),
modalId: uniqueId('design-deletion-confirmation-'),
};
},
};
......
<script>
import _ from 'underscore';
import { throttle } from 'lodash';
import DesignImage from './image.vue';
import DesignOverlay from './design_overlay.vue';
......@@ -66,7 +66,7 @@ export default {
const { presentationViewport } = this.$refs;
if (!presentationViewport) return;
this.scrollThrottled = _.throttle(() => {
this.scrollThrottled = throttle(() => {
this.shiftZoomFocalPoint();
}, 400);
......
<script>
import _ from 'underscore';
import { throttle } from 'lodash';
export default {
props: {
......@@ -36,7 +36,7 @@ export default {
mounted() {
this.onImgLoad();
this.resizeThrottled = _.throttle(() => {
this.resizeThrottled = throttle(() => {
// NOTE: if imageStyle is set, then baseImageSize
// won't change due to resize. We must still emit a
// `resize` event so that the parent can handle
......
import Vue from 'vue';
import VueApollo from 'vue-apollo';
import _ from 'underscore';
import { uniqueId } from 'lodash';
import { defaultDataIdFromObject } from 'apollo-cache-inmemory';
import createDefaultClient from '~/lib/graphql';
......@@ -15,7 +15,7 @@ const defaultClient = createDefaultClient(
dataIdFromObject: object => {
// eslint-disable-next-line no-underscore-dangle, @gitlab/require-i18n-strings
if (object.__typename === 'Design') {
return object.id && object.image ? `${object.id}-${object.image}` : _.uniqueId();
return object.id && object.image ? `${object.id}-${object.image}` : uniqueId();
}
return defaultDataIdFromObject(object);
},
......
import { propertyOf } from 'underscore';
import { propertyOf } from 'lodash';
import createFlash from '~/flash';
import { s__ } from '~/locale';
import projectQuery from '../graphql/queries/project.query.graphql';
......
import { uniqueId } from 'underscore';
import { uniqueId } from 'lodash';
import { VALID_DESIGN_FILE_MIMETYPE } from '../constants';
export const isValidDesignFile = ({ type }) =>
......
import underscore from 'underscore';
import {
extractCurrentDiscussion,
extractDiscussions,
......@@ -8,6 +7,8 @@ import {
isValidDesignFile,
} from 'ee/design_management/utils/design_management_utils';
jest.mock('lodash/uniqueId', () => () => 1);
describe('extractCurrentDiscussion', () => {
let discussions;
......@@ -75,7 +76,6 @@ describe('version parser', () => {
describe('optimistic responses', () => {
it('correctly generated for designManagementUpload', () => {
jest.spyOn(underscore, 'uniqueId').mockImplementation(() => 1);
const expectedResponse = {
__typename: 'Mutation',
designManagementUpload: {
......
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