diff --git a/app/views/shared/wikis/edit.html.haml b/app/views/shared/wikis/edit.html.haml index 6bbce6b80d845d76f78e351e6af6a957fdd8021e..fc56a191cad3190b5935aded9f136d407b9c4c24 100644 --- a/app/views/shared/wikis/edit.html.haml +++ b/app/views/shared/wikis/edit.html.haml @@ -1,5 +1,7 @@ - wiki_page_title @page, @page.persisted? ? _('Edit') : _('New') - add_page_specific_style 'page_bundles/wiki' +- @gfm_form = true +- @noteable_type = 'Wiki' - if @error #js-wiki-error{ data: { error: @error, wiki_page_path: wiki_page_path(@wiki, @page) } } diff --git a/ee/spec/features/groups/wikis_spec.rb b/ee/spec/features/groups/wikis_spec.rb index 283db95a4941a15d9af362c1083401fbc53c12a5..ec443e24f330a8298867d11f1135eabfcebb26c8 100644 --- a/ee/spec/features/groups/wikis_spec.rb +++ b/ee/spec/features/groups/wikis_spec.rb @@ -7,7 +7,8 @@ let_it_be(:user) { create(:user) } - let(:wiki) { create(:group_wiki, user: user) } + let(:group) { create(:group) } + let(:wiki) { create(:group_wiki, user: user, group: group) } before do stub_group_wikis(true) diff --git a/spec/support/shared_examples/features/wiki/autocomplete_shared_examples.rb b/spec/support/shared_examples/features/wiki/autocomplete_shared_examples.rb new file mode 100644 index 0000000000000000000000000000000000000000..79de2aedf3bdf403d095819737e9478ea8c9e9cf --- /dev/null +++ b/spec/support/shared_examples/features/wiki/autocomplete_shared_examples.rb @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +RSpec.shared_examples 'autocompletes items' do + before do + if defined?(project) + create(:issue, project: project, title: 'My Cool Linked Issue') + create(:merge_request, source_project: project, title: 'My Cool Merge Request') + create(:label, project: project, title: 'My Cool Label') + create(:milestone, project: project, title: 'My Cool Milestone') + + project.add_maintainer(create(:user, name: 'JohnDoe123')) + else # group wikis + project = create(:project, group: group) + + create(:issue, project: project, title: 'My Cool Linked Issue') + create(:merge_request, source_project: project, title: 'My Cool Merge Request') + create(:group_label, group: group, title: 'My Cool Label') + create(:milestone, group: group, title: 'My Cool Milestone') + + project.add_maintainer(create(:user, name: 'JohnDoe123')) + end + end + + it 'works well for issues, labels, MRs, members, etc' do + fill_in :wiki_content, with: "#" + expect(page).to have_text 'My Cool Linked Issue' + + fill_in :wiki_content, with: "~" + expect(page).to have_text 'My Cool Label' + + fill_in :wiki_content, with: "!" + expect(page).to have_text 'My Cool Merge Request' + + fill_in :wiki_content, with: "%" + expect(page).to have_text 'My Cool Milestone' + + fill_in :wiki_content, with: "@" + expect(page).to have_text 'JohnDoe123' + + fill_in :wiki_content, with: ':smil' + expect(page).to have_text 'smile_cat' + end +end diff --git a/spec/support/shared_examples/features/wiki/user_updates_wiki_page_shared_examples.rb b/spec/support/shared_examples/features/wiki/user_updates_wiki_page_shared_examples.rb index 12a4c6d7583dd2e5d2610ad46fd5c49efce8d109..79c7c1891ac2d32ebe7024a28022e9015e8fc441 100644 --- a/spec/support/shared_examples/features/wiki/user_updates_wiki_page_shared_examples.rb +++ b/spec/support/shared_examples/features/wiki/user_updates_wiki_page_shared_examples.rb @@ -146,6 +146,8 @@ it_behaves_like 'edits content using the content editor' end end + + it_behaves_like 'autocompletes items' end context 'when the page is in a subdir', :js do