Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Rose <sam@gitlab.com>2017-04-18 21:01:15 +0300
committerSam Rose <sam@gitlab.com>2017-04-28 20:02:57 +0300
commit575d9027d952f22949c60539e9b6384b04c2c75b (patch)
treed2a93912ab3f856e1786ac435b3f4e362df53047 /spec/features/issues/form_spec.rb
parent1f47b570b93b64df8b365865431eef8d04cd79e4 (diff)
Display check next to assigned user in dropdown
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