IssueNotesRefactor: Fix award emoji specs.
This commit is contained in:
parent
0555d6918c
commit
a22665931d
7 changed files with 11 additions and 8 deletions
|
@ -51,7 +51,7 @@ export default {
|
|||
'btn-close': this.isIssueOpen,
|
||||
'js-note-target-close': this.isIssueOpen,
|
||||
'js-note-target-reopen': !this.isIssueOpen,
|
||||
}
|
||||
};
|
||||
},
|
||||
canUpdateIssue() {
|
||||
const { issueData } = window.gl;
|
||||
|
|
|
@ -137,7 +137,6 @@ export default {
|
|||
:authorId="author.id"
|
||||
:noteId="note.id"
|
||||
:accessLevel="note.human_access"
|
||||
:canAward="note.emoji_awardable"
|
||||
:canEdit="note.current_user.can_edit"
|
||||
:canDelete="note.current_user.can_edit"
|
||||
:canReportAsAbuse="canReportAsAbuse"
|
||||
|
|
|
@ -78,6 +78,9 @@ export default {
|
|||
data-position="right"
|
||||
href="#"
|
||||
title="Add reaction">
|
||||
<i
|
||||
aria-hidden="true"
|
||||
class="fa fa-spinner fa-spin"></i>
|
||||
<span
|
||||
v-html="emojiSmiling"
|
||||
class="link-highlight award-control-icon-neutral"></span>
|
||||
|
|
|
@ -173,7 +173,7 @@ export default {
|
|||
data-placement="bottom"
|
||||
type="button">
|
||||
<span v-html="getAwardHTML(awardName)"></span>
|
||||
<span class="award-control-text">
|
||||
<span class="award-control-text js-counter">
|
||||
{{awardList.length}}
|
||||
</span>
|
||||
</button>
|
||||
|
|
|
@ -225,6 +225,7 @@ const actions = {
|
|||
return context.dispatch(methodToDispatch, noteData)
|
||||
.then((res) => {
|
||||
const { errors } = res;
|
||||
const commandsChanges = res.commands_changes;
|
||||
|
||||
if (hasQuickActions && Object.keys(errors).length) {
|
||||
context.dispatch('poll');
|
||||
|
@ -232,12 +233,11 @@ const actions = {
|
|||
new Flash('Commands applied', 'notice', $(noteData.flashContainer)); // eslint-disable-line
|
||||
}
|
||||
|
||||
|
||||
if (res.commands_changes.emoji_award) {
|
||||
if (commandsChanges && commandsChanges.emoji_award) {
|
||||
const votesBlock = $('.js-awards-block').eq(0);
|
||||
|
||||
loadAwardsHandler().then((awardsHandler) => {
|
||||
awardsHandler.addAwardToEmojiBar(votesBlock, res.commands_changes.emoji_award);
|
||||
awardsHandler.addAwardToEmojiBar(votesBlock, commandsChanges.emoji_award);
|
||||
awardsHandler.scrollToAwards();
|
||||
}).catch(() => {
|
||||
const msg = 'Something went wrong while adding your award. Please try again.';
|
||||
|
|
|
@ -70,13 +70,13 @@ describe 'Awards Emoji', feature: true do
|
|||
it 'toggles the smiley emoji on a note', js: true do
|
||||
toggle_smiley_emoji(true)
|
||||
|
||||
within('.note-awards') do
|
||||
within('.note-body') do
|
||||
expect(find(emoji_counter)).to have_text("1")
|
||||
end
|
||||
|
||||
toggle_smiley_emoji(false)
|
||||
|
||||
within('.note-awards') do
|
||||
within('.note-body') do
|
||||
expect(page).not_to have_selector(emoji_counter)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module QuickActionsHelpers
|
|||
page.within('.js-main-target-form') do
|
||||
fill_in 'note-body', with: text
|
||||
find('.js-comment-submit-button').trigger('click')
|
||||
wait_for_requests
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue