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