Commit b54c02bd authored by Enrique Alcántara's avatar Enrique Alcántara

Merge branch '25335-display-emoji-name-in-awards-list-tooltip' into 'master'

Add emoji name to tooltip

See merge request gitlab-org/gitlab!65439
parents 7b1d0dfb 9022559e
...@@ -93,12 +93,12 @@ export default { ...@@ -93,12 +93,12 @@ export default {
return { return {
name, name,
list, list,
title: this.getAwardListTitle(list), title: this.getAwardListTitle(list, name),
classes: this.getAwardClassBindings(list), classes: this.getAwardClassBindings(list),
html: glEmojiTag(name), html: glEmojiTag(name),
}; };
}, },
getAwardListTitle(awardsList) { getAwardListTitle(awardsList, name) {
if (!awardsList.length) { if (!awardsList.length) {
return ''; return '';
} }
...@@ -128,7 +128,7 @@ export default { ...@@ -128,7 +128,7 @@ export default {
// We have 10+ awarded user, join them with comma and add `and x more`. // We have 10+ awarded user, join them with comma and add `and x more`.
if (remainingAwardList.length) { if (remainingAwardList.length) {
title = sprintf( title = sprintf(
__(`%{listToShow}, and %{awardsListLength} more.`), __(`%{listToShow}, and %{awardsListLength} more`),
{ {
listToShow: namesToShow.join(', '), listToShow: namesToShow.join(', '),
awardsListLength: remainingAwardList.length, awardsListLength: remainingAwardList.length,
...@@ -146,7 +146,7 @@ export default { ...@@ -146,7 +146,7 @@ export default {
title = namesToShow.join(__(' and ')); title = namesToShow.join(__(' and '));
} }
return title; return title + sprintf(__(' reacted with :%{name}:'), { name });
}, },
handleAward(awardName) { handleAward(awardName) {
if (!this.canAwardEmoji) { if (!this.canAwardEmoji) {
......
...@@ -77,6 +77,9 @@ msgstr "" ...@@ -77,6 +77,9 @@ msgstr ""
msgid " or references (e.g. path/to/project!merge_request_id)" msgid " or references (e.g. path/to/project!merge_request_id)"
msgstr "" msgstr ""
msgid " reacted with :%{name}:"
msgstr ""
msgid "\"%{path}\" did not exist on \"%{ref}\"" msgid "\"%{path}\" did not exist on \"%{ref}\""
msgstr "" msgstr ""
...@@ -687,7 +690,7 @@ msgstr "" ...@@ -687,7 +690,7 @@ msgstr ""
msgid "%{link_start}Start the title with %{draft_snippet}%{link_end} to prevent a merge request that is a work in progress from being merged before it's ready." msgid "%{link_start}Start the title with %{draft_snippet}%{link_end} to prevent a merge request that is a work in progress from being merged before it's ready."
msgstr "" msgstr ""
msgid "%{listToShow}, and %{awardsListLength} more." msgid "%{listToShow}, and %{awardsListLength} more"
msgstr "" msgstr ""
msgid "%{location} is missing required keys: %{keys}" msgid "%{location} is missing required keys: %{keys}"
......
...@@ -63,7 +63,7 @@ RSpec.describe 'User interacts with awards' do ...@@ -63,7 +63,7 @@ RSpec.describe 'User interacts with awards' do
page.within('.awards') do page.within('.awards') do
expect(page).to have_selector('[data-testid="award-button"]') expect(page).to have_selector('[data-testid="award-button"]')
expect(page.find('[data-testid="award-button"].selected .js-counter')).to have_content('1') expect(page.find('[data-testid="award-button"].selected .js-counter')).to have_content('1')
expect(page).to have_css('[data-testid="award-button"].selected[title="You"]') expect(page).to have_css('[data-testid="award-button"].selected[title="You reacted with :8ball:"]')
expect do expect do
page.find('[data-testid="award-button"].selected').click page.find('[data-testid="award-button"].selected').click
......
...@@ -7,7 +7,7 @@ exports[`vue_shared/components/awards_list default matches snapshot 1`] = ` ...@@ -7,7 +7,7 @@ exports[`vue_shared/components/awards_list default matches snapshot 1`] = `
<button <button
class="btn gl-mr-3 gl-my-2 btn-default btn-md gl-button" class="btn gl-mr-3 gl-my-2 btn-default btn-md gl-button"
data-testid="award-button" data-testid="award-button"
title="Ada, Leonardo, and Marie" title="Ada, Leonardo, and Marie reacted with :thumbsup:"
type="button" type="button"
> >
<!----> <!---->
...@@ -37,7 +37,7 @@ exports[`vue_shared/components/awards_list default matches snapshot 1`] = ` ...@@ -37,7 +37,7 @@ exports[`vue_shared/components/awards_list default matches snapshot 1`] = `
<button <button
class="btn gl-mr-3 gl-my-2 btn-default btn-md gl-button selected" class="btn gl-mr-3 gl-my-2 btn-default btn-md gl-button selected"
data-testid="award-button" data-testid="award-button"
title="You, Ada, and Marie" title="You, Ada, and Marie reacted with :thumbsdown:"
type="button" type="button"
> >
<!----> <!---->
...@@ -67,7 +67,7 @@ exports[`vue_shared/components/awards_list default matches snapshot 1`] = ` ...@@ -67,7 +67,7 @@ exports[`vue_shared/components/awards_list default matches snapshot 1`] = `
<button <button
class="btn gl-mr-3 gl-my-2 btn-default btn-md gl-button" class="btn gl-mr-3 gl-my-2 btn-default btn-md gl-button"
data-testid="award-button" data-testid="award-button"
title="Ada and Jane" title="Ada and Jane reacted with :smile:"
type="button" type="button"
> >
<!----> <!---->
...@@ -97,7 +97,7 @@ exports[`vue_shared/components/awards_list default matches snapshot 1`] = ` ...@@ -97,7 +97,7 @@ exports[`vue_shared/components/awards_list default matches snapshot 1`] = `
<button <button
class="btn gl-mr-3 gl-my-2 btn-default btn-md gl-button selected" class="btn gl-mr-3 gl-my-2 btn-default btn-md gl-button selected"
data-testid="award-button" data-testid="award-button"
title="You, Ada, Jane, and Leonardo" title="You, Ada, Jane, and Leonardo reacted with :ok_hand:"
type="button" type="button"
> >
<!----> <!---->
...@@ -127,7 +127,7 @@ exports[`vue_shared/components/awards_list default matches snapshot 1`] = ` ...@@ -127,7 +127,7 @@ exports[`vue_shared/components/awards_list default matches snapshot 1`] = `
<button <button
class="btn gl-mr-3 gl-my-2 btn-default btn-md gl-button selected" class="btn gl-mr-3 gl-my-2 btn-default btn-md gl-button selected"
data-testid="award-button" data-testid="award-button"
title="You" title="You reacted with :cactus:"
type="button" type="button"
> >
<!----> <!---->
...@@ -157,7 +157,7 @@ exports[`vue_shared/components/awards_list default matches snapshot 1`] = ` ...@@ -157,7 +157,7 @@ exports[`vue_shared/components/awards_list default matches snapshot 1`] = `
<button <button
class="btn gl-mr-3 gl-my-2 btn-default btn-md gl-button" class="btn gl-mr-3 gl-my-2 btn-default btn-md gl-button"
data-testid="award-button" data-testid="award-button"
title="Marie" title="Marie reacted with :a:"
type="button" type="button"
> >
<!----> <!---->
...@@ -187,7 +187,7 @@ exports[`vue_shared/components/awards_list default matches snapshot 1`] = ` ...@@ -187,7 +187,7 @@ exports[`vue_shared/components/awards_list default matches snapshot 1`] = `
<button <button
class="btn gl-mr-3 gl-my-2 btn-default btn-md gl-button selected" class="btn gl-mr-3 gl-my-2 btn-default btn-md gl-button selected"
data-testid="award-button" data-testid="award-button"
title="You" title="You reacted with :b:"
type="button" type="button"
> >
<!----> <!---->
......
...@@ -98,43 +98,43 @@ describe('vue_shared/components/awards_list', () => { ...@@ -98,43 +98,43 @@ describe('vue_shared/components/awards_list', () => {
classes: REACTION_CONTROL_CLASSES, classes: REACTION_CONTROL_CLASSES,
count: 3, count: 3,
html: matchingEmojiTag(EMOJI_THUMBSUP), html: matchingEmojiTag(EMOJI_THUMBSUP),
title: 'Ada, Leonardo, and Marie', title: `Ada, Leonardo, and Marie reacted with :${EMOJI_THUMBSUP}:`,
}, },
{ {
classes: [...REACTION_CONTROL_CLASSES, 'selected'], classes: [...REACTION_CONTROL_CLASSES, 'selected'],
count: 3, count: 3,
html: matchingEmojiTag(EMOJI_THUMBSDOWN), html: matchingEmojiTag(EMOJI_THUMBSDOWN),
title: 'You, Ada, and Marie', title: `You, Ada, and Marie reacted with :${EMOJI_THUMBSDOWN}:`,
}, },
{ {
classes: REACTION_CONTROL_CLASSES, classes: REACTION_CONTROL_CLASSES,
count: 2, count: 2,
html: matchingEmojiTag(EMOJI_SMILE), html: matchingEmojiTag(EMOJI_SMILE),
title: 'Ada and Jane', title: `Ada and Jane reacted with :${EMOJI_SMILE}:`,
}, },
{ {
classes: [...REACTION_CONTROL_CLASSES, 'selected'], classes: [...REACTION_CONTROL_CLASSES, 'selected'],
count: 4, count: 4,
html: matchingEmojiTag(EMOJI_OK), html: matchingEmojiTag(EMOJI_OK),
title: 'You, Ada, Jane, and Leonardo', title: `You, Ada, Jane, and Leonardo reacted with :${EMOJI_OK}:`,
}, },
{ {
classes: [...REACTION_CONTROL_CLASSES, 'selected'], classes: [...REACTION_CONTROL_CLASSES, 'selected'],
count: 1, count: 1,
html: matchingEmojiTag(EMOJI_CACTUS), html: matchingEmojiTag(EMOJI_CACTUS),
title: 'You', title: `You reacted with :${EMOJI_CACTUS}:`,
}, },
{ {
classes: REACTION_CONTROL_CLASSES, classes: REACTION_CONTROL_CLASSES,
count: 1, count: 1,
html: matchingEmojiTag(EMOJI_A), html: matchingEmojiTag(EMOJI_A),
title: 'Marie', title: `Marie reacted with :${EMOJI_A}:`,
}, },
{ {
classes: [...REACTION_CONTROL_CLASSES, 'selected'], classes: [...REACTION_CONTROL_CLASSES, 'selected'],
count: 1, count: 1,
html: matchingEmojiTag(EMOJI_B), html: matchingEmojiTag(EMOJI_B),
title: 'You', title: `You reacted with :${EMOJI_B}:`,
}, },
]); ]);
}); });
...@@ -246,13 +246,13 @@ describe('vue_shared/components/awards_list', () => { ...@@ -246,13 +246,13 @@ describe('vue_shared/components/awards_list', () => {
classes: REACTION_CONTROL_CLASSES, classes: REACTION_CONTROL_CLASSES,
count: 1, count: 1,
html: matchingEmojiTag(EMOJI_100), html: matchingEmojiTag(EMOJI_100),
title: 'Marie', title: `Marie reacted with :${EMOJI_100}:`,
}, },
{ {
classes: REACTION_CONTROL_CLASSES, classes: REACTION_CONTROL_CLASSES,
count: 1, count: 1,
html: matchingEmojiTag(EMOJI_SMILE), html: matchingEmojiTag(EMOJI_SMILE),
title: 'Marie', title: `Marie reacted with :${EMOJI_SMILE}:`,
}, },
]); ]);
}); });
......
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