diff options
author | Fatih Acet <acetfatih@gmail.com> | 2017-07-20 17:42:37 +0300 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2017-07-21 22:35:26 +0300 |
commit | a22665931d85f3980f9b0f0e5301142a0803087d (patch) | |
tree | b5bd965e0c6f331b7fc8b30fc75499bbf21305c0 | |
parent | 0555d6918ccb92faf7a62927820efdac3576f1f3 (diff) |
IssueNotesRefactor: Fix award emoji specs.
7 files changed, 11 insertions, 8 deletions
diff --git a/app/assets/javascripts/notes/components/issue_comment_form.vue b/app/assets/javascripts/notes/components/issue_comment_form.vue index 8c47aeb2e75..df03bee400a 100644 --- a/app/assets/javascripts/notes/components/issue_comment_form.vue +++ b/app/assets/javascripts/notes/components/issue_comment_form.vue @@ -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; diff --git a/app/assets/javascripts/notes/components/issue_note.vue b/app/assets/javascripts/notes/components/issue_note.vue index 39f153a3045..a18e51eb48d 100644 --- a/app/assets/javascripts/notes/components/issue_note.vue +++ b/app/assets/javascripts/notes/components/issue_note.vue @@ -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" diff --git a/app/assets/javascripts/notes/components/issue_note_actions.vue b/app/assets/javascripts/notes/components/issue_note_actions.vue index 0851dfb9674..f0fe13f3f37 100644 --- a/app/assets/javascripts/notes/components/issue_note_actions.vue +++ b/app/assets/javascripts/notes/components/issue_note_actions.vue @@ -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> diff --git a/app/assets/javascripts/notes/components/issue_note_awards_list.vue b/app/assets/javascripts/notes/components/issue_note_awards_list.vue index f84442f15c1..01805ec11f3 100644 --- a/app/assets/javascripts/notes/components/issue_note_awards_list.vue +++ b/app/assets/javascripts/notes/components/issue_note_awards_list.vue @@ -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> diff --git a/app/assets/javascripts/notes/stores/issue_notes_store.js b/app/assets/javascripts/notes/stores/issue_notes_store.js index 9632a353435..3c6b9b2f79d 100644 --- a/app/assets/javascripts/notes/stores/issue_notes_store.js +++ b/app/assets/javascripts/notes/stores/issue_notes_store.js @@ -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.'; diff --git a/spec/features/issues/award_emoji_spec.rb b/spec/features/issues/award_emoji_spec.rb index 823c779e0d9..f6368167665 100644 --- a/spec/features/issues/award_emoji_spec.rb +++ b/spec/features/issues/award_emoji_spec.rb @@ -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 diff --git a/spec/support/quick_actions_helpers.rb b/spec/support/quick_actions_helpers.rb index fc8243429f5..87d1e705fc8 100644 --- a/spec/support/quick_actions_helpers.rb +++ b/spec/support/quick_actions_helpers.rb @@ -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 |