Commit 6bf781e4 authored by Filipa Lacerda's avatar Filipa Lacerda

Fix autocomplete broken tests

parent b67e333c
...@@ -98,7 +98,7 @@ import initChangesDropdown from './init_changes_dropdown'; ...@@ -98,7 +98,7 @@ import initChangesDropdown from './init_changes_dropdown';
path = page.split(':'); path = page.split(':');
shortcut_handler = null; shortcut_handler = null;
$('.js-gfm-input').each((i, el) => { $('.js-gfm-input:not(.js-vue-textarea)').each((i, el) => {
const gfm = new GfmAutoComplete(gl.GfmAutoComplete && gl.GfmAutoComplete.dataSources); const gfm = new GfmAutoComplete(gl.GfmAutoComplete && gl.GfmAutoComplete.dataSources);
const enableGFM = gl.utils.convertPermissionToBoolean(el.dataset.supportsAutocomplete); const enableGFM = gl.utils.convertPermissionToBoolean(el.dataset.supportsAutocomplete);
gfm.setup($(el), { gfm.setup($(el), {
......
...@@ -240,7 +240,7 @@ ...@@ -240,7 +240,7 @@
<textarea <textarea
id="note-body" id="note-body"
name="note[note]" name="note[note]"
class="note-textarea js-vue-comment-form js-gfm-input js-autosize markdown-area" class="note-textarea js-vue-comment-form js-gfm-input js-autosize markdown-area js-vue-textarea"
data-supports-quick-actions="true" data-supports-quick-actions="true"
aria-label="Description" aria-label="Description"
v-model="note" v-model="note"
......
...@@ -131,7 +131,7 @@ ...@@ -131,7 +131,7 @@
<textarea <textarea
id="note_note" id="note_note"
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 js-vue-textarea"
:data-supports-quick-actions="!isEditing" :data-supports-quick-actions="!isEditing"
aria-label="Description" aria-label="Description"
v-model="note" v-model="note"
......
- @gfm_form = true
- content_for :note_actions do - content_for :note_actions do
- if can?(current_user, :update_issue, @issue) - if can?(current_user, :update_issue, @issue)
= link_to 'Reopen issue', issue_path(@issue, issue: {state_event: :reopen}, format: 'json'), data: {original_text: "Reopen issue", alternative_text: "Comment & reopen issue"}, class: "btn btn-nr btn-reopen btn-comment js-note-target-reopen #{issue_button_visibility(@issue, false)}", title: 'Reopen issue' = link_to 'Reopen issue', issue_path(@issue, issue: {state_event: :reopen}, format: 'json'), data: {original_text: "Reopen issue", alternative_text: "Comment & reopen issue"}, class: "btn btn-nr btn-reopen btn-comment js-note-target-reopen #{issue_button_visibility(@issue, false)}", title: 'Reopen issue'
...@@ -16,5 +17,3 @@ ...@@ -16,5 +17,3 @@
- content_for :page_specific_javascripts do - content_for :page_specific_javascripts do
= webpack_bundle_tag 'common_vue' = webpack_bundle_tag 'common_vue'
= webpack_bundle_tag 'notes' = webpack_bundle_tag 'notes'
= render "layouts/init_auto_complete"
...@@ -11,12 +11,16 @@ feature 'Member autocomplete', :js do ...@@ -11,12 +11,16 @@ feature 'Member autocomplete', :js do
sign_in(user) sign_in(user)
end end
shared_examples "open suggestions when typing @" do shared_examples "open suggestions when typing @" do |resource_name|
before do before do
page.within('.new-note') do page.within('.new-note') do
if resource_name == 'issue'
find('#note-body').send_keys('@')
else
find('#note_note').send_keys('@') find('#note_note').send_keys('@')
end end
end end
end
it 'suggests noteable author and note author' do it 'suggests noteable author and note author' do
page.within('.atwho-view', visible: true) do page.within('.atwho-view', visible: true) do
...@@ -32,7 +36,7 @@ feature 'Member autocomplete', :js do ...@@ -32,7 +36,7 @@ feature 'Member autocomplete', :js do
visit project_issue_path(project, noteable) visit project_issue_path(project, noteable)
end end
include_examples "open suggestions when typing @" include_examples "open suggestions when typing @", 'issue'
end end
context 'adding a new note on a Merge Request' do context 'adding a new note on a Merge Request' do
...@@ -45,7 +49,7 @@ feature 'Member autocomplete', :js do ...@@ -45,7 +49,7 @@ feature 'Member autocomplete', :js do
visit project_merge_request_path(project, noteable) visit project_merge_request_path(project, noteable)
end end
include_examples "open suggestions when typing @" include_examples "open suggestions when typing @", 'merge_request'
end end
context 'adding a new note on a Commit' do context 'adding a new note on a Commit' do
...@@ -60,6 +64,6 @@ feature 'Member autocomplete', :js do ...@@ -60,6 +64,6 @@ feature 'Member autocomplete', :js do
visit project_commit_path(project, noteable) visit project_commit_path(project, noteable)
end end
include_examples "open suggestions when typing @" include_examples "open suggestions when typing @", 'commit'
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