Commit 380994e5 authored by Phil Hughes's avatar Phil Hughes

Merge branch 'fix-user-dropdown-checkmark' into 'multiple_assignees_review'

Fix bug where checkmark would not show up on selected user dropdown

See merge request !1771
parents 10ba2def 058b6f71
......@@ -415,20 +415,31 @@ import eventHub from './sidebar/event_hub';
const $el = $(e.currentTarget);
$el.find('.is-active').removeClass('is-active');
const initialSelected = getSelected().forEach((selectedId) => {
$el.find(`li[data-user-id="${selectedId}"] .dropdown-menu-user-link`).addClass('is-active');
});
function highlightSelected(id) {
$el.find(`li[data-user-id="${id}"] .dropdown-menu-user-link`).addClass('is-active');
}
if ($selectbox[0]) {
getSelected().forEach((selectedId) => highlightSelected(selectedId));
} else {
highlightSelected(selectedId);
}
},
updateLabel: $dropdown.data('dropdown-title'),
renderRow: function(user) {
var avatar, img, listClosingTags, listWithName, listWithUserName, selected, username;
var avatar, img, listClosingTags, listWithName, listWithUserName, username;
username = user.username ? "@" + user.username : "";
avatar = user.avatar_url ? user.avatar_url : false;
const fieldName = this.fieldName;
const field = $dropdown.closest('.selectbox').find("input[name='" + fieldName + "'][value='" + user.id + "']");
if (field.length) {
selected = true;
let selected = user.id === parseInt(selectedId, 10);
if (this.multiSelect) {
const fieldName = this.fieldName;
const field = $dropdown.closest('.selectbox').find("input[name='" + fieldName + "'][value='" + user.id + "']");
if (field.length) {
selected = true;
}
}
img = "";
......
......@@ -30,6 +30,11 @@ RSpec.describe 'Dashboard Issues', feature: true do
find('#assignee_id', visible: false).set('')
find('.js-author-search', match: :first).click
find('.dropdown-menu-author li a', match: :first, text: current_user.to_reference).click
find('.js-author-search', match: :first).click
page.within '.dropdown-menu-user' do
expect(find('.dropdown-menu-author li a.is-active', match: :first, text: current_user.to_reference)).to be_visible
end
expect(page).to have_content(authored_issue.title)
expect(page).to have_content(authored_issue_on_public_project.title)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment