diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-21 10:08:36 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-21 10:08:36 +0300 |
commit | 48aff82709769b098321c738f3444b9bdaa694c6 (patch) | |
tree | e00c7c43e2d9b603a5a6af576b1685e400410dee /spec/features/issues/gfm_autocomplete_spec.rb | |
parent | 879f5329ee916a948223f8f43d77fba4da6cd028 (diff) |
Add latest changes from gitlab-org/gitlab@13-5-stable-eev13.5.0-rc42
Diffstat (limited to 'spec/features/issues/gfm_autocomplete_spec.rb')
-rw-r--r-- | spec/features/issues/gfm_autocomplete_spec.rb | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/spec/features/issues/gfm_autocomplete_spec.rb b/spec/features/issues/gfm_autocomplete_spec.rb index 0165fba9ace..ff78b9e608f 100644 --- a/spec/features/issues/gfm_autocomplete_spec.rb +++ b/spec/features/issues/gfm_autocomplete_spec.rb @@ -6,7 +6,9 @@ RSpec.describe 'GFM autocomplete', :js do let_it_be(:user_xss_title) { 'eve <img src=x onerror=alert(2)<img src=x onerror=alert(1)>' } let_it_be(:user_xss) { create(:user, name: user_xss_title, username: 'xss.user') } let_it_be(:user) { create(:user, name: '💃speciąl someone💃', username: 'someone.special') } - let_it_be(:project) { create(:project) } + let_it_be(:group) { create(:group, name: 'Ancestor') } + let_it_be(:child_group) { create(:group, parent: group, name: 'My group') } + let_it_be(:project) { create(:project, group: child_group) } let_it_be(:label) { create(:label, project: project, title: 'special+') } let(:issue) { create(:issue, project: project) } @@ -530,7 +532,7 @@ RSpec.describe 'GFM autocomplete', :js do expect(page).to have_selector('.tribute-container', visible: true) - expect(find('.tribute-container ul', visible: true).text).to have_content(user_xss.username) + expect(find('.tribute-container ul', visible: true)).to have_text(user_xss.username) end it 'selects the first item for assignee dropdowns' do @@ -558,6 +560,24 @@ RSpec.describe 'GFM autocomplete', :js do expect(find('.tribute-container ul', visible: true)).to have_content(user.name) end + context 'when autocompleting for groups' do + it 'shows the group when searching for the name of the group' do + page.within '.timeline-content-form' do + find('#note-body').native.send_keys('@mygroup') + end + + expect(find('.tribute-container ul', visible: true)).to have_text('My group') + end + + it 'does not show the group when searching for the name of the parent of the group' do + page.within '.timeline-content-form' do + find('#note-body').native.send_keys('@ancestor') + end + + expect(find('.tribute-container ul', visible: true)).not_to have_text('My group') + end + end + context 'if a selected value has special characters' do it 'wraps the result in double quotes' do note = find('#note-body') |