Commit a2266593 authored by Fatih Acet's avatar Fatih Acet

IssueNotesRefactor: Fix award emoji specs.

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