From 3da6d7697155682739a7ec3b0e89c53a8bb222e3 Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Mon, 12 Jun 2017 15:46:51 -0500 Subject: Re-enable autocomplete for milestones, tags, releases, and wiki Fix https://gitlab.com/gitlab-org/gitlab-ce/issues/33598 --- spec/features/tags/master_creates_tag_spec.rb | 94 ++++++++++++++++----------- spec/features/tags/master_updates_tag_spec.rb | 11 ++++ 2 files changed, 67 insertions(+), 38 deletions(-) (limited to 'spec/features/tags') diff --git a/spec/features/tags/master_creates_tag_spec.rb b/spec/features/tags/master_creates_tag_spec.rb index af25eebed13..9030a2f2ff5 100644 --- a/spec/features/tags/master_creates_tag_spec.rb +++ b/spec/features/tags/master_creates_tag_spec.rb @@ -7,61 +7,79 @@ feature 'Master creates tag', feature: true do before do project.team << [user, :master] login_with(user) - visit namespace_project_tags_path(project.namespace, project) end - scenario 'with an invalid name displays an error' do - create_tag_in_form(tag: 'v 1.0', ref: 'master') + context 'from tag list' do + before do + visit namespace_project_tags_path(project.namespace, project) + end - expect(page).to have_content 'Tag name invalid' - end + scenario 'with an invalid name displays an error' do + create_tag_in_form(tag: 'v 1.0', ref: 'master') - scenario 'with an invalid reference displays an error' do - create_tag_in_form(tag: 'v2.0', ref: 'foo') + expect(page).to have_content 'Tag name invalid' + end - expect(page).to have_content 'Target foo is invalid' - end + scenario 'with an invalid reference displays an error' do + create_tag_in_form(tag: 'v2.0', ref: 'foo') - scenario 'that already exists displays an error' do - create_tag_in_form(tag: 'v1.1.0', ref: 'master') + expect(page).to have_content 'Target foo is invalid' + end - expect(page).to have_content 'Tag v1.1.0 already exists' - end + scenario 'that already exists displays an error' do + create_tag_in_form(tag: 'v1.1.0', ref: 'master') + + expect(page).to have_content 'Tag v1.1.0 already exists' + end - scenario 'with multiline message displays the message in a
 block' do
-    create_tag_in_form(tag: 'v3.0', ref: 'master', message: "Awesome tag message\n\n- hello\n- world")
+    scenario 'with multiline message displays the message in a 
 block' do
+      create_tag_in_form(tag: 'v3.0', ref: 'master', message: "Awesome tag message\n\n- hello\n- world")
 
-    expect(current_path).to eq(
-      namespace_project_tag_path(project.namespace, project, 'v3.0'))
-    expect(page).to have_content 'v3.0'
-    page.within 'pre.wrap' do
-      expect(page).to have_content "Awesome tag message\n\n- hello\n- world"
+      expect(current_path).to eq(
+        namespace_project_tag_path(project.namespace, project, 'v3.0'))
+      expect(page).to have_content 'v3.0'
+      page.within 'pre.wrap' do
+        expect(page).to have_content "Awesome tag message\n\n- hello\n- world"
+      end
     end
-  end
 
-  scenario 'with multiline release notes parses the release note as Markdown' do
-    create_tag_in_form(tag: 'v4.0', ref: 'master', desc: "Awesome release notes\n\n- hello\n- world")
+    scenario 'with multiline release notes parses the release note as Markdown' do
+      create_tag_in_form(tag: 'v4.0', ref: 'master', desc: "Awesome release notes\n\n- hello\n- world")
 
-    expect(current_path).to eq(
-      namespace_project_tag_path(project.namespace, project, 'v4.0'))
-    expect(page).to have_content 'v4.0'
-    page.within '.description' do
-      expect(page).to have_content 'Awesome release notes'
-      expect(page).to have_selector('ul li', count: 2)
+      expect(current_path).to eq(
+        namespace_project_tag_path(project.namespace, project, 'v4.0'))
+      expect(page).to have_content 'v4.0'
+      page.within '.description' do
+        expect(page).to have_content 'Awesome release notes'
+        expect(page).to have_selector('ul li', count: 2)
+      end
+    end
+
+    scenario 'opens dropdown for ref', js: true do
+      click_link 'New tag'
+      ref_row = find('.form-group:nth-of-type(2) .col-sm-10')
+      page.within ref_row do
+        ref_input = find('[name="ref"]', visible: false)
+        expect(ref_input.value).to eq 'master'
+        expect(find('.dropdown-toggle-text')).to have_content 'master'
+
+        find('.js-branch-select').trigger('click')
+
+        expect(find('.dropdown-menu')).to have_content 'empty-branch'
+      end
     end
   end
 
-  scenario 'opens dropdown for ref', js: true do
-    click_link 'New tag'
-    ref_row = find('.form-group:nth-of-type(2) .col-sm-10')
-    page.within ref_row do
-      ref_input = find('[name="ref"]', visible: false)
-      expect(ref_input.value).to eq 'master'
-      expect(find('.dropdown-toggle-text')).to have_content 'master'
+  context 'from new tag page' do
+    before do
+      visit new_namespace_project_tag_path(project.namespace, project)
+    end
 
-      find('.js-branch-select').trigger('click')
+    it 'description has autocomplete', :js do
+      find('#release_description').native.send_keys('')
+      fill_in 'release_description', with: '@'
 
-      expect(find('.dropdown-menu')).to have_content 'empty-branch'
+      expect(page).to have_selector('.atwho-view')
     end
   end
 
diff --git a/spec/features/tags/master_updates_tag_spec.rb b/spec/features/tags/master_updates_tag_spec.rb
index 6b5b3122f72..3582f41938a 100644
--- a/spec/features/tags/master_updates_tag_spec.rb
+++ b/spec/features/tags/master_updates_tag_spec.rb
@@ -24,6 +24,17 @@ feature 'Master updates tag', feature: true do
       expect(page).to have_content 'v1.1.0'
       expect(page).to have_content 'Awesome release notes'
     end
+
+    scenario 'description has autocomplete', :js do
+      page.within(first('.content-list .controls')) do
+        click_link 'Edit release notes'
+      end
+
+      find('#release_description').native.send_keys('')
+      fill_in 'release_description', with: '@'
+
+      expect(page).to have_selector('.atwho-view')
+    end
   end
 
   context 'from a specific tag page' do
-- 
cgit v1.2.3