diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/features/issues/gfm_autocomplete_spec.rb | 11 | ||||
-rw-r--r-- | spec/helpers/application_helper_spec.rb | 4 | ||||
-rw-r--r-- | spec/javascripts/gfm_auto_complete_spec.js | 2 | ||||
-rw-r--r-- | spec/routing/project_routing_spec.rb | 3 |
4 files changed, 15 insertions, 5 deletions
diff --git a/spec/features/issues/gfm_autocomplete_spec.rb b/spec/features/issues/gfm_autocomplete_spec.rb index 98e37d8011a..08bf9bc7243 100644 --- a/spec/features/issues/gfm_autocomplete_spec.rb +++ b/spec/features/issues/gfm_autocomplete_spec.rb @@ -5,6 +5,7 @@ describe 'GFM autocomplete', :js do let(:project) { create(:project) } let(:label) { create(:label, project: project, title: 'special+') } let(:issue) { create(:issue, project: project) } + let!(:project_snippet) { create(:project_snippet, project: project, title: 'code snippet') } before do project.add_maintainer(user) @@ -301,6 +302,16 @@ describe 'GFM autocomplete', :js do end end + it 'shows project snippets' do + page.within '.timeline-content-form' do + find('#note-body').native.send_keys('$') + end + + page.within '.atwho-container' do + expect(page).to have_content(project_snippet.title) + end + end + private def expect_to_wrap(should_wrap, item, note, value) diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index 1238cfbd1e7..4135f31e051 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -174,9 +174,7 @@ describe ApplicationHelper do it 'returns paths for autocomplete_sources_controller' do sources = helper.autocomplete_data_sources(project, noteable_type) - - expect(sources.keys).to match_array([:members, :issues, :mergeRequests, :labels, :milestones, :commands]) - + expect(sources.keys).to match_array([:members, :issues, :mergeRequests, :labels, :milestones, :commands, :snippets]) sources.keys.each do |key| expect(sources[key]).not_to be_nil end diff --git a/spec/javascripts/gfm_auto_complete_spec.js b/spec/javascripts/gfm_auto_complete_spec.js index 4f9cacf2724..b57c4943c01 100644 --- a/spec/javascripts/gfm_auto_complete_spec.js +++ b/spec/javascripts/gfm_auto_complete_spec.js @@ -103,7 +103,7 @@ describe('GfmAutoComplete', function () { gfmAutoCompleteCallbacks.matcher.call(context, flag, subtext) ); - const flagsUseDefaultMatcher = ['@', '#', '!', '~', '%']; + const flagsUseDefaultMatcher = ['@', '#', '!', '~', '%', '$']; const otherFlags = ['/', ':']; const flags = flagsUseDefaultMatcher.concat(otherFlags); diff --git a/spec/routing/project_routing_spec.rb b/spec/routing/project_routing_spec.rb index 56df8dddbc1..bdfb12dc5df 100644 --- a/spec/routing/project_routing_spec.rb +++ b/spec/routing/project_routing_spec.rb @@ -133,8 +133,9 @@ describe 'project routing' do # labels_namespace_project_autocomplete_sources_path GET /:project_id/autocomplete_sources/labels(.:format) projects/autocomplete_sources#labels # milestones_namespace_project_autocomplete_sources_path GET /:project_id/autocomplete_sources/milestones(.:format) projects/autocomplete_sources#milestones # commands_namespace_project_autocomplete_sources_path GET /:project_id/autocomplete_sources/commands(.:format) projects/autocomplete_sources#commands + # snippets_namespace_project_autocomplete_sources_path GET /:project_id/autocomplete_sources/snippets(.:format) projects/autocomplete_sources#snippets describe Projects::AutocompleteSourcesController, 'routing' do - [:members, :issues, :merge_requests, :labels, :milestones, :commands].each do |action| + [:members, :issues, :merge_requests, :labels, :milestones, :commands, :snippets].each do |action| it "to ##{action}" do expect(get("/gitlab/gitlabhq/autocomplete_sources/#{action}")).to route_to("projects/autocomplete_sources##{action}", namespace_id: 'gitlab', project_id: 'gitlabhq') end |