Commit a4a219c7 authored by David O'Regan's avatar David O'Regan

Merge branch 'ps-replace-uid-ref-with-uniqueid' into 'master'

Replace _uid reference with uniqueId

See merge request gitlab-org/gitlab!55635
parents 181f69db 6c484fd6
<script> <script>
import { GlAvatar, GlPopover } from '@gitlab/ui'; import { GlAvatar, GlPopover } from '@gitlab/ui';
import { uniqueId } from 'lodash';
import { formatDate } from '~/lib/utils/datetime_utility'; import { formatDate } from '~/lib/utils/datetime_utility';
import { truncate } from '~/lib/utils/text_utility'; import { truncate } from '~/lib/utils/text_utility';
import { __, sprintf } from '~/locale'; import { __, sprintf } from '~/locale';
...@@ -57,8 +58,7 @@ export default { ...@@ -57,8 +58,7 @@ export default {
}); });
}, },
rotationAssigneeUniqueID() { rotationAssigneeUniqueID() {
const { _uid } = this; return uniqueId('rotation-assignee-');
return `${this.assignee.user.id}-${_uid}`;
}, },
rotationMobileView() { rotationMobileView() {
return this.shiftWidth <= SHIFT_WIDTHS.xs; return this.shiftWidth <= SHIFT_WIDTHS.xs;
......
...@@ -8,6 +8,8 @@ import { formatDate } from '~/lib/utils/datetime_utility'; ...@@ -8,6 +8,8 @@ import { formatDate } from '~/lib/utils/datetime_utility';
import { truncate } from '~/lib/utils/text_utility'; import { truncate } from '~/lib/utils/text_utility';
import mockRotations from '../../mocks/mock_rotation.json'; import mockRotations from '../../mocks/mock_rotation.json';
jest.mock('lodash/uniqueId', () => (prefix) => `${prefix}fakeUniqueId`);
describe('RotationAssignee', () => { describe('RotationAssignee', () => {
let wrapper; let wrapper;
...@@ -71,9 +73,7 @@ describe('RotationAssignee', () => { ...@@ -71,9 +73,7 @@ describe('RotationAssignee', () => {
}); });
it('should render an assignee schedule and rotation information in a popover', () => { it('should render an assignee schedule and rotation information in a popover', () => {
// eslint-disable-next-line no-underscore-dangle expect(findPopOver().attributes('target')).toBe('rotation-assignee-fakeUniqueId');
const UID = wrapper.vm._uid;
expect(findPopOver().attributes('target')).toBe(`${assignee.participant.user.id}-${UID}`);
expect(findStartsAt().text()).toContain(formattedDate(assignee.startsAt)); expect(findStartsAt().text()).toContain(formattedDate(assignee.startsAt));
expect(findEndsAt().text()).toContain(formattedDate(assignee.endsAt)); expect(findEndsAt().text()).toContain(formattedDate(assignee.endsAt));
}); });
......
...@@ -83,7 +83,7 @@ exports[`RotationsListSectionComponent when the timeframe includes today renders ...@@ -83,7 +83,7 @@ exports[`RotationsListSectionComponent when the timeframe includes today renders
<div <div
class="gl-h-6 gl-bg-data-viz-blue-500 gl-display-flex gl-justify-content-center gl-align-items-center" class="gl-h-6 gl-bg-data-viz-blue-500 gl-display-flex gl-justify-content-center gl-align-items-center"
data-testid="rotation-assignee" data-testid="rotation-assignee"
id="1-12" id="rotation-assignee-2"
> >
<div <div
class="gl-text-white gl-display-flex gl-justify-content-center gl-align-items-center" class="gl-text-white gl-display-flex gl-justify-content-center gl-align-items-center"
...@@ -123,7 +123,7 @@ exports[`RotationsListSectionComponent when the timeframe includes today renders ...@@ -123,7 +123,7 @@ exports[`RotationsListSectionComponent when the timeframe includes today renders
<div <div
class="gl-h-6 gl-bg-data-viz-orange-500 gl-display-flex gl-justify-content-center gl-align-items-center" class="gl-h-6 gl-bg-data-viz-orange-500 gl-display-flex gl-justify-content-center gl-align-items-center"
data-testid="rotation-assignee" data-testid="rotation-assignee"
id="2-16" id="rotation-assignee-3"
> >
<div <div
class="gl-text-white gl-display-flex gl-justify-content-center gl-align-items-center" class="gl-text-white gl-display-flex gl-justify-content-center gl-align-items-center"
......
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