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