summaryrefslogtreecommitdiff
path: root/spec/features/issues/form_spec.rb
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-05-05 12:31:10 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-05-05 12:31:10 +0200
commite944fd7064b5a04a334b6c500c9ee7db29a46538 (patch)
tree7418e54f3774ca676040a16a30a4a9cd7c922100 /spec/features/issues/form_spec.rb
parent3aa92cb5cbe8456c845e16d14489591dd81dbcb3 (diff)
parent3a2b60f7a0109cdb84e8727a2625318a746e84dc (diff)
downloadgitlab-ce-fix/gb/hide-environment-external-url-btn-when-not-provided.tar.gz
* commit '3a2b60f7a0109cdb84e8727a2625318a746e84dc': (254 commits) Fixed Karma spec Reject EE reserved namespace paths in CE as well Updated webpack config Include the bundler:audit job into the static-analysis job Document serializers Add artifact file page that uses the blob viewer Pipeline table mini graph dropdown remains open when table is refreshed Adds off for event hub Compile gitlab-shell go executables Allow to create new branch and empty WIP merge request from issue page Moved to a view spec Improving copy of CONTRIBUTING.md, PROCESS.md, and code_review.md Convert seconds to minutes and hours on chat notifations Disable navigation to Pages config if Pages is disabled Sort the network graph both by commit date and topographically. Add tooltips to note action buttons Add breadcrumb, build header and pipelines submenu to artifacts browser Update todos screenshots removes the possibility of commit messages having carriage returns Handle incoming emails from aliases correctly ...
Diffstat (limited to 'spec/features/issues/form_spec.rb')
-rw-r--r--spec/features/issues/form_spec.rb38
1 files changed, 38 insertions, 0 deletions
diff --git a/spec/features/issues/form_spec.rb b/spec/features/issues/form_spec.rb
index 755992069ff..21b8cf3add5 100644
--- a/spec/features/issues/form_spec.rb
+++ b/spec/features/issues/form_spec.rb
@@ -2,6 +2,7 @@ require 'rails_helper'
describe 'New/edit issue', feature: true, js: true do
include GitlabRoutingHelper
+ include ActionView::Helpers::JavaScriptHelper
let!(:project) { create(:project) }
let!(:user) { create(:user)}
@@ -105,6 +106,33 @@ describe 'New/edit issue', feature: true, js: true do
expect(find('.js-label-select')).to have_content('Labels')
end
+
+ it 'correctly updates the selected user when changing assignee' do
+ click_button 'Assignee'
+ page.within '.dropdown-menu-user' do
+ click_link user.name
+ end
+
+ expect(find('input[name="issue[assignee_id]"]', visible: false).value).to match(user.id.to_s)
+
+ click_button user.name
+
+ expect(find('.dropdown-menu-user a.is-active').first(:xpath, '..')['data-user-id']).to eq(user.id.to_s)
+
+ # check the ::before pseudo element to ensure checkmark icon is present
+ expect(before_for_selector('.dropdown-menu-selectable a.is-active')).not_to eq('')
+ expect(before_for_selector('.dropdown-menu-selectable a:not(.is-active)')).to eq('')
+
+ page.within '.dropdown-menu-user' do
+ click_link user2.name
+ end
+
+ expect(find('input[name="issue[assignee_id]"]', visible: false).value).to match(user2.id.to_s)
+
+ click_button user2.name
+
+ expect(find('.dropdown-menu-user a.is-active').first(:xpath, '..')['data-user-id']).to eq(user2.id.to_s)
+ end
end
context 'edit issue' do
@@ -154,4 +182,14 @@ describe 'New/edit issue', feature: true, js: true do
end
end
end
+
+ def before_for_selector(selector)
+ js = <<-JS.strip_heredoc
+ (function(selector) {
+ var el = document.querySelector(selector);
+ return window.getComputedStyle(el, '::before').getPropertyValue('content');
+ })("#{escape_javascript(selector)}")
+ JS
+ page.evaluate_script(js)
+ end
end