Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
d65e6206
Commit
d65e6206
authored
May 31, 2021
by
Jackie Fraser
Committed by
Paul Slaughter
May 31, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add group avatars to invite modal dropdown
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/62263
parent
fe76e8d4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
10 deletions
+35
-10
app/assets/javascripts/invite_members/components/group_select.vue
...ts/javascripts/invite_members/components/group_select.vue
+17
-3
spec/frontend/invite_members/components/group_select_spec.js
spec/frontend/invite_members/components/group_select_spec.js
+18
-7
No files found.
app/assets/javascripts/invite_members/components/group_select.vue
View file @
d65e6206
<
script
>
import
{
GlDropdown
,
GlDropdownItem
,
GlDropdownText
,
GlSearchBoxByType
}
from
'
@gitlab/ui
'
;
import
{
GlAvatarLabeled
,
GlDropdown
,
GlDropdownItem
,
GlDropdownText
,
GlSearchBoxByType
,
}
from
'
@gitlab/ui
'
;
import
{
debounce
}
from
'
lodash
'
;
import
Api
from
'
~/api
'
;
import
{
s__
}
from
'
~/locale
'
;
...
...
@@ -8,6 +14,7 @@ import { SEARCH_DELAY } from '../constants';
export
default
{
name
:
'
GroupSelect
'
,
components
:
{
GlAvatarLabeled
,
GlDropdown
,
GlDropdownItem
,
GlDropdownText
,
...
...
@@ -49,6 +56,7 @@ export default {
id
:
group
.
id
,
name
:
group
.
full_name
,
path
:
group
.
path
,
avatarUrl
:
group
.
avatar_url
,
}));
this
.
isFetching
=
false
;
})
...
...
@@ -82,7 +90,7 @@ export default {
menu-class=
"gl-w-full!"
>
<gl-search-box-by-type
v-model
.trim
=
"searchTerm"
v-model=
"searchTerm"
:is-loading=
"isFetching"
:placeholder=
"$options.i18n.searchPlaceholder"
data-qa-selector=
"group_select_dropdown_search_field"
...
...
@@ -93,7 +101,13 @@ export default {
:name=
"group.name"
@
click=
"selectGroup(group)"
>
{{
group
.
name
}}
<gl-avatar-labeled
:label=
"group.name"
:src=
"group.avatarUrl"
:entity-id=
"group.id"
:entity-name=
"group.name"
:size=
"32"
/>
</gl-dropdown-item>
<gl-dropdown-text
v-if=
"isFetchResultEmpty && !isFetching"
data-testid=
"empty-result-message"
>
<span
class=
"gl-text-gray-500"
>
{{
$options
.
i18n
.
emptySearchResult
}}
</span>
...
...
spec/frontend/invite_members/components/group_select_spec.js
View file @
d65e6206
import
{
Gl
Dropdown
,
GlDropdownItem
,
GlSearchBoxByType
}
from
'
@gitlab/ui
'
;
import
{
Gl
AvatarLabeled
,
GlDropdown
,
GlSearchBoxByType
}
from
'
@gitlab/ui
'
;
import
{
mount
}
from
'
@vue/test-utils
'
;
import
waitForPromises
from
'
helpers/wait_for_promises
'
;
import
Api
from
'
~/api
'
;
...
...
@@ -8,8 +8,8 @@ const createComponent = () => {
return
mount
(
GroupSelect
,
{});
};
const
group1
=
{
id
:
1
,
full_name
:
'
Group One
'
};
const
group2
=
{
id
:
2
,
full_name
:
'
Group Two
'
};
const
group1
=
{
id
:
1
,
full_name
:
'
Group One
'
,
avatar_url
:
'
test
'
};
const
group2
=
{
id
:
2
,
full_name
:
'
Group Two
'
,
avatar_url
:
'
test
'
};
const
allGroups
=
[
group1
,
group2
];
describe
(
'
GroupSelect
'
,
()
=>
{
...
...
@@ -29,10 +29,10 @@ describe('GroupSelect', () => {
const
findSearchBoxByType
=
()
=>
wrapper
.
findComponent
(
GlSearchBoxByType
);
const
findDropdown
=
()
=>
wrapper
.
findComponent
(
GlDropdown
);
const
findDropdownToggle
=
()
=>
findDropdown
().
find
(
'
button[aria-haspopup="true"]
'
);
const
find
DropdownItemByText
=
(
text
)
=>
const
find
AvatarByLabel
=
(
text
)
=>
wrapper
.
findAllComponents
(
Gl
DropdownItem
)
.
wrappers
.
find
((
dropdownItemWrapper
)
=>
dropdownItemWrapper
.
text
(
)
===
text
);
.
findAllComponents
(
Gl
AvatarLabeled
)
.
wrappers
.
find
((
dropdownItemWrapper
)
=>
dropdownItemWrapper
.
props
(
'
label
'
)
===
text
);
it
(
'
renders GlSearchBoxByType with default attributes
'
,
()
=>
{
expect
(
findSearchBoxByType
().
exists
()).
toBe
(
true
);
...
...
@@ -74,9 +74,20 @@ describe('GroupSelect', () => {
});
});
describe
(
'
avatar label
'
,
()
=>
{
it
(
'
includes the correct attributes with name and avatar_url
'
,
()
=>
{
expect
(
findAvatarByLabel
(
group1
.
full_name
).
attributes
()).
toMatchObject
({
src
:
group1
.
avatar_url
,
'
entity-id
'
:
`
${
group1
.
id
}
`
,
'
entity-name
'
:
group1
.
full_name
,
size
:
'
32
'
,
});
});
});
describe
(
'
when group is selected from the dropdown
'
,
()
=>
{
beforeEach
(()
=>
{
find
DropdownItemByText
(
group1
.
full_name
).
vm
.
$emit
(
'
click
'
);
find
AvatarByLabel
(
group1
.
full_name
).
trigger
(
'
click
'
);
});
it
(
'
emits `input` event used by `v-model`
'
,
()
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment