Fix open discussions

Put back deleted tests
This commit is contained in:
Filipa Lacerda 2017-08-11 15:28:46 +01:00
parent b38e690344
commit b96a3d4d60
8 changed files with 24 additions and 11 deletions

View File

@ -1,5 +1,5 @@
<script> <script>
/* global Flash, Autosave */ /* global Flash */
import { mapActions, mapGetters } from 'vuex'; import { mapActions, mapGetters } from 'vuex';
import { SYSTEM_NOTE } from '../constants'; import { SYSTEM_NOTE } from '../constants';
import issueNote from './issue_note.vue'; import issueNote from './issue_note.vue';

View File

@ -140,11 +140,25 @@
return title; return title;
}, },
handleAward(awardName) { handleAward(awardName) {
let parsedName;
// 100 and 1234 emoji are a number. Callback for v-for click sends it as a string
switch(awardName) {
case '100':
parsedName = 100;
break;
case '1234':
parsedName = 1234;
break;
default:
parsedName = awardName;
break;
}
const data = { const data = {
endpoint: this.toggleAwardPath, endpoint: this.toggleAwardPath,
noteId: this.noteId, noteId: this.noteId,
// 100 emoji is a number. Callback for v-for click sends it as a string awardName: parsedName,
awardName: awardName === '100' ? 100 : awardName,
}; };
this.toggleAwardRequest(data) this.toggleAwardRequest(data)

View File

@ -129,7 +129,6 @@
:quick-actions-docs="quickActionsDocsUrl" :quick-actions-docs="quickActionsDocsUrl"
:add-spacing-classes="false"> :add-spacing-classes="false">
<textarea <textarea
id="note-body"
name="note[note]" name="note[note]"
class="note-textarea js-gfm-input js-autosize markdown-area js-vue-issue-note-form" class="note-textarea js-gfm-input js-autosize markdown-area js-vue-issue-note-form"
:data-supports-quick-actions="!isEditing" :data-supports-quick-actions="!isEditing"

View File

@ -86,7 +86,7 @@ export const saveNote = ({ commit, dispatch }, noteData) => {
const { errors } = res; const { errors } = res;
const commandsChanges = res.commands_changes; const commandsChanges = res.commands_changes;
if (hasQuickActions && Object.keys(errors).length) { if (hasQuickActions && errors && Object.keys(errors).length) {
dispatch('fetchData'); dispatch('fetchData');
$('.js-gfm-input').trigger('clear-commands-cache.atwho'); $('.js-gfm-input').trigger('clear-commands-cache.atwho');

View File

@ -17,4 +17,4 @@
= webpack_bundle_tag 'common_vue' = webpack_bundle_tag 'common_vue'
= webpack_bundle_tag 'notes' = webpack_bundle_tag 'notes'
= render "layouts/init_auto_complete" = render "layouts/init_auto_complete"

View File

@ -156,7 +156,7 @@ module SharedNote
page.find('.current-note-edit-form textarea') page.find('.current-note-edit-form textarea')
page.within(".current-note-edit-form") do page.within(".current-note-edit-form") do
fill_in '#note-body', with: '+1 Awesome!' fill_in 'note[note]', with: '+1 Awesome!'
click_button 'Save comment' click_button 'Save comment'
end end
wait_for_requests wait_for_requests

View File

@ -67,7 +67,7 @@ feature 'Merge Requests > User uses quick actions', js: true do
it 'does not change the WIP prefix' do it 'does not change the WIP prefix' do
write_note("/wip") write_note("/wip")
expect(page).to have_content '/wip' expect(page).not_to have_content '/wip'
expect(page).not_to have_content 'Commands applied' expect(page).not_to have_content 'Commands applied'
expect(merge_request.reload.work_in_progress?).to eq false expect(merge_request.reload.work_in_progress?).to eq false
@ -78,7 +78,7 @@ feature 'Merge Requests > User uses quick actions', js: true do
describe 'merging the MR from the note' do describe 'merging the MR from the note' do
context 'when the current user can merge the MR' do context 'when the current user can merge the MR' do
it 'merges the MR' do it 'merges the MR' do
write_note("/merge", false) write_note("/merge")
expect(page).to have_content 'Commands applied' expect(page).to have_content 'Commands applied'
@ -197,7 +197,7 @@ feature 'Merge Requests > User uses quick actions', js: true do
it 'does not change target branch' do it 'does not change target branch' do
write_note('/target_branch merge-test') write_note('/target_branch merge-test')
expect(page).to have_content '/target_branch merge-test' expect(page).not_to have_content '/target_branch merge-test'
expect(merge_request.target_branch).to eq 'feature' expect(merge_request.target_branch).to eq 'feature'
end end

View File

@ -15,7 +15,7 @@ feature 'Member autocomplete', :js do
before do before do
page.within('.new-note') do page.within('.new-note') do
if note.noteable_type === 'Issue' if note.noteable_type === 'Issue'
find('#note-body').send_keys('@') find('.js-vue-comment-form').send_keys('@')
else else
find('#note_note').send_keys('@') find('#note_note').send_keys('@')
end end