Commit 91958cfe authored by Mark Florian's avatar Mark Florian

Merge branch '227563-fix-assignee-avatar-tooltip-w-special-char' into 'master'

Fix assignee avatar tooltip w special char names

See merge request gitlab-org/gitlab!67250
parents 2afa9308 b1118c62
<script>
import { GlTooltipDirective, GlLink } from '@gitlab/ui';
import { __, sprintf } from '~/locale';
import { __ } from '~/locale';
import { isUserBusy } from '~/set_status_modal/utils';
import AssigneeAvatar from './assignee_avatar.vue';
......@@ -32,10 +32,9 @@ const generateAssigneeTooltip = ({
}
if (tooltipHasName && statusInformation.length) {
return sprintf(__('%{name} %{status}'), {
name,
status: statusInformation.map(paranthesize).join(' '),
});
const status = statusInformation.map(paranthesize).join(' ');
return `${name} ${status}`;
}
return name;
......
......@@ -733,9 +733,6 @@ msgstr ""
msgid "%{name_with_link} namespace has run out of Shared Runner Pipeline minutes. No new jobs or pipelines in its projects will run."
msgstr ""
msgid "%{name} %{status}"
msgstr ""
msgid "%{name} (Busy)"
msgstr ""
......
......@@ -81,30 +81,33 @@ describe('AssigneeAvatarLink component', () => {
);
describe.each`
tooltipHasName | availability | canMerge | expected
${true} | ${'Busy'} | ${false} | ${'Root (Busy) (cannot merge)'}
${true} | ${'Busy'} | ${true} | ${'Root (Busy)'}
${true} | ${''} | ${false} | ${'Root (cannot merge)'}
${true} | ${''} | ${true} | ${'Root'}
${false} | ${'Busy'} | ${false} | ${'Cannot merge'}
${false} | ${'Busy'} | ${true} | ${''}
${false} | ${''} | ${false} | ${'Cannot merge'}
${false} | ${''} | ${true} | ${''}
tooltipHasName | name | availability | canMerge | expected
${true} | ${"Rabbit O'Hare"} | ${''} | ${true} | ${"Rabbit O'Hare"}
${true} | ${"Rabbit O'Hare"} | ${'Busy'} | ${false} | ${"Rabbit O'Hare (Busy) (cannot merge)"}
${true} | ${'Root'} | ${'Busy'} | ${false} | ${'Root (Busy) (cannot merge)'}
${true} | ${'Root'} | ${'Busy'} | ${true} | ${'Root (Busy)'}
${true} | ${'Root'} | ${''} | ${false} | ${'Root (cannot merge)'}
${true} | ${'Root'} | ${''} | ${true} | ${'Root'}
${false} | ${'Root'} | ${'Busy'} | ${false} | ${'Cannot merge'}
${false} | ${'Root'} | ${'Busy'} | ${true} | ${''}
${false} | ${'Root'} | ${''} | ${false} | ${'Cannot merge'}
${false} | ${'Root'} | ${''} | ${true} | ${''}
`(
"with tooltipHasName=$tooltipHasName and availability='$availability' and canMerge=$canMerge",
({ tooltipHasName, availability, canMerge, expected }) => {
"with name=$name tooltipHasName=$tooltipHasName and availability='$availability' and canMerge=$canMerge",
({ name, tooltipHasName, availability, canMerge, expected }) => {
beforeEach(() => {
createComponent({
tooltipHasName,
user: {
...userDataMock(),
name,
can_merge: canMerge,
availability,
},
});
});
it('sets tooltip to $expected', () => {
it(`sets tooltip to "${expected}"`, () => {
expect(findTooltipText()).toBe(expected);
});
},
......
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