Commit d0e32a12 authored by Savas Vedova's avatar Savas Vedova

Merge branch '324714-long-name-overlap' into 'master'

Fix: update oncall rotation name to truncate

See merge request gitlab-org/gitlab!56762
parents a162a0aa cd28d49e
...@@ -108,7 +108,7 @@ export default { ...@@ -108,7 +108,7 @@ export default {
<span <span
class="details-cell gl-display-flex gl-justify-content-space-between gl-align-items-center gl-pl-3" class="details-cell gl-display-flex gl-justify-content-space-between gl-align-items-center gl-pl-3"
> >
<span class="gl-text-truncated">{{ $options.i18n.addRotationLabel }}</span> <span class="gl-text-truncate">{{ $options.i18n.addRotationLabel }}</span>
</span> </span>
<span <span
v-for="(timeframeItem, index) in timeframeToDraw" v-for="(timeframeItem, index) in timeframeToDraw"
...@@ -125,7 +125,13 @@ export default { ...@@ -125,7 +125,13 @@ export default {
<span <span
class="details-cell gl-display-flex gl-justify-content-space-between gl-align-items-center gl-pl-3" class="details-cell gl-display-flex gl-justify-content-space-between gl-align-items-center gl-pl-3"
> >
<span class="gl-text-truncated">{{ rotation.name }}</span> <span
v-gl-tooltip="{ boundary: 'viewport', title: rotation.name }"
class="gl-text-truncate"
:aria-label="rotation.name"
:data-testid="`rotation-name-${rotation.id}`"
>{{ rotation.name }}</span
>
<gl-button-group class="gl-px-2"> <gl-button-group class="gl-px-2">
<gl-button <gl-button
v-gl-modal="$options.editRotationModalId" v-gl-modal="$options.editRotationModalId"
......
---
title: Update oncall schedule rotation names to truncate if they are too long
merge_request: 56762
author:
type: fixed
...@@ -12,7 +12,9 @@ exports[`RotationsListSectionComponent when the timeframe includes today renders ...@@ -12,7 +12,9 @@ exports[`RotationsListSectionComponent when the timeframe includes today renders
class="details-cell gl-display-flex gl-justify-content-space-between gl-align-items-center gl-pl-3" class="details-cell gl-display-flex gl-justify-content-space-between gl-align-items-center gl-pl-3"
> >
<span <span
class="gl-text-truncated" aria-label="Rotation 242"
class="gl-text-truncate"
data-testid="rotation-name-gid://gitlab/IncidentManagement::OncallRotation/2"
> >
Rotation 242 Rotation 242
</span> </span>
......
...@@ -6,6 +6,8 @@ import RotationsListSection from 'ee/oncall_schedules/components/schedule/compon ...@@ -6,6 +6,8 @@ import RotationsListSection from 'ee/oncall_schedules/components/schedule/compon
import { getTimeframeForWeeksView } from 'ee/oncall_schedules/components/schedule/utils'; import { getTimeframeForWeeksView } from 'ee/oncall_schedules/components/schedule/utils';
import { PRESET_TYPES } from 'ee/oncall_schedules/constants'; import { PRESET_TYPES } from 'ee/oncall_schedules/constants';
import { useFakeDate } from 'helpers/fake_date'; import { useFakeDate } from 'helpers/fake_date';
import { createMockDirective, getBinding } from 'helpers/vue_mock_directive';
import { extendedWrapper } from 'helpers/vue_test_utils_helper';
import { scheduleIid } from '../../mocks/apollo_mock'; import { scheduleIid } from '../../mocks/apollo_mock';
import mockRotations from '../../mocks/mock_rotation.json'; import mockRotations from '../../mocks/mock_rotation.json';
...@@ -19,7 +21,8 @@ describe('RotationsListSectionComponent', () => { ...@@ -19,7 +21,8 @@ describe('RotationsListSectionComponent', () => {
presetType = PRESET_TYPES.WEEKS, presetType = PRESET_TYPES.WEEKS,
timeframe = mockTimeframeWeeks, timeframe = mockTimeframeWeeks,
} = {}) { } = {}) {
wrapper = mount(RotationsListSection, { wrapper = extendedWrapper(
mount(RotationsListSection, {
propsData: { propsData: {
presetType, presetType,
timeframe, timeframe,
...@@ -32,13 +35,18 @@ describe('RotationsListSectionComponent', () => { ...@@ -32,13 +35,18 @@ describe('RotationsListSectionComponent', () => {
stubs: { stubs: {
GlCard, GlCard,
}, },
}); directives: {
GlTooltip: createMockDirective(),
},
}),
);
} }
const findTimelineCells = () => wrapper.findAll('[data-testid="timeline-cell"]'); const findTimelineCells = () => wrapper.findAllByTestId('timeline-cell');
const findRotationAssignees = () => wrapper.findAllComponents(RotationsAssignee); const findRotationAssignees = () => wrapper.findAllComponents(RotationsAssignee);
const findCurrentDayIndicatorContent = () => const findCurrentDayIndicatorContent = () => wrapper.findByTestId('current-day-indicator');
wrapper.find('[data-testid="current-day-indicator"]'); const findRotationName = (id) => wrapper.findByTestId(`rotation-name-${id}`);
const findRotationNameTooltip = (id) => getBinding(findRotationName(id).element, 'gl-tooltip');
afterEach(() => { afterEach(() => {
if (wrapper) { if (wrapper) {
...@@ -75,6 +83,12 @@ describe('RotationsListSectionComponent', () => { ...@@ -75,6 +83,12 @@ describe('RotationsListSectionComponent', () => {
mockRotations[0].shifts.nodes[0].participant.user, mockRotations[0].shifts.nodes[0].participant.user,
); );
}); });
it('renders a tooltip with the rotation name', () => {
const rotationNameTT = findRotationNameTooltip(mockRotations[0].id);
expect(rotationNameTT.value).toBeDefined();
expect(rotationNameTT.value.title).toBe(mockRotations[0].name);
});
}); });
describe('when the timeframe does not include today', () => { describe('when the timeframe does not include today', () => {
......
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