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
0e274436
Commit
0e274436
authored
Nov 20, 2020
by
Scott Stern
Committed by
Phil Hughes
Nov 20, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add loading state to initial load of assignees in dropdown
parent
67b39236
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
102 additions
and
42 deletions
+102
-42
app/assets/javascripts/boards/components/board_assignee_dropdown.vue
...javascripts/boards/components/board_assignee_dropdown.vue
+44
-39
changelogs/unreleased/ss-add-loading-to-assignees.yml
changelogs/unreleased/ss-add-loading-to-assignees.yml
+5
-0
ee/spec/frontend/boards/components/board_content_sidebar_spec.js
.../frontend/boards/components/board_content_sidebar_spec.js
+10
-1
spec/frontend/boards/components/board_assignee_dropdown_spec.js
...rontend/boards/components/board_assignee_dropdown_spec.js
+43
-2
No files found.
app/assets/javascripts/boards/components/board_assignee_dropdown.vue
View file @
0e274436
...
...
@@ -6,6 +6,7 @@ import {
GlAvatarLabeled
,
GlAvatarLink
,
GlSearchBoxByType
,
GlLoadingIcon
,
}
from
'
@gitlab/ui
'
;
import
{
__
,
n__
}
from
'
~/locale
'
;
import
IssuableAssignees
from
'
~/sidebar/components/assignees/issuable_assignees.vue
'
;
...
...
@@ -32,6 +33,7 @@ export default {
GlAvatarLabeled
,
GlAvatarLink
,
GlSearchBoxByType
,
GlLoadingIcon
,
},
data
()
{
return
{
...
...
@@ -132,45 +134,48 @@ export default {
<gl-search-box-by-type
v-model.trim=
"search"
/>
</
template
>
<
template
#items
>
<gl-dropdown-item
:is-checked=
"selectedIsEmpty"
data-testid=
"unassign"
class=
"mt-2"
@
click=
"selectAssignee()"
>
{{
$options
.
i18n
.
unassigned
}}
</gl-dropdown-item
>
<gl-dropdown-divider
data-testid=
"unassign-divider"
/>
<gl-dropdown-item
v-for=
"item in selected"
:key=
"item.id"
:is-checked=
"isChecked(item.username)"
@
click=
"unselect(item.username)"
>
<gl-avatar-link>
<gl-avatar-labeled
:size=
"32"
:label=
"item.name"
:sub-label=
"item.username"
:src=
"item.avatarUrl || item.avatar"
/>
</gl-avatar-link>
</gl-dropdown-item>
<gl-dropdown-divider
v-if=
"!selectedIsEmpty"
data-testid=
"selected-user-divider"
/>
<gl-dropdown-item
v-for=
"unselectedUser in unSelectedFiltered"
:key=
"unselectedUser.id"
:data-testid=
"`item_$
{unselectedUser.name}`"
@click="selectAssignee(unselectedUser)"
>
<gl-avatar-link>
<gl-avatar-labeled
:size=
"32"
:label=
"unselectedUser.name"
:sub-label=
"unselectedUser.username"
:src=
"unselectedUser.avatarUrl || unselectedUser.avatar"
/>
</gl-avatar-link>
</gl-dropdown-item>
<gl-loading-icon
v-if=
"$apollo.queries.participants.loading"
size=
"lg"
/>
<template
v-else
>
<gl-dropdown-item
:is-checked=
"selectedIsEmpty"
data-testid=
"unassign"
class=
"mt-2"
@
click=
"selectAssignee()"
>
{{
$options
.
i18n
.
unassigned
}}
</gl-dropdown-item
>
<gl-dropdown-divider
data-testid=
"unassign-divider"
/>
<gl-dropdown-item
v-for=
"item in selected"
:key=
"item.id"
:is-checked=
"isChecked(item.username)"
@
click=
"unselect(item.username)"
>
<gl-avatar-link>
<gl-avatar-labeled
:size=
"32"
:label=
"item.name"
:sub-label=
"item.username"
:src=
"item.avatarUrl || item.avatar"
/>
</gl-avatar-link>
</gl-dropdown-item>
<gl-dropdown-divider
v-if=
"!selectedIsEmpty"
data-testid=
"selected-user-divider"
/>
<gl-dropdown-item
v-for=
"unselectedUser in unSelectedFiltered"
:key=
"unselectedUser.id"
:data-testid=
"`item_$
{unselectedUser.name}`"
@click="selectAssignee(unselectedUser)"
>
<gl-avatar-link>
<gl-avatar-labeled
:size=
"32"
:label=
"unselectedUser.name"
:sub-label=
"unselectedUser.username"
:src=
"unselectedUser.avatarUrl || unselectedUser.avatar"
/>
</gl-avatar-link>
</gl-dropdown-item>
</
template
>
</template>
</multi-select-dropdown>
</template>
...
...
changelogs/unreleased/ss-add-loading-to-assignees.yml
0 → 100644
View file @
0e274436
---
title
:
Add loading state to assignees dropdown
merge_request
:
47848
author
:
type
:
added
ee/spec/frontend/boards/components/board_content_sidebar_spec.js
View file @
0e274436
...
...
@@ -26,6 +26,15 @@ describe('ee/BoardContentSidebar', () => {
'
board-sidebar-due-date
'
:
'
<div></div>
'
,
'
board-sidebar-subscription
'
:
'
<div></div>
'
,
},
mocks
:
{
$apollo
:
{
queries
:
{
participants
:
{
loading
:
false
,
},
},
},
},
});
};
...
...
@@ -55,7 +64,7 @@ describe('ee/BoardContentSidebar', () => {
expect
(
wrapper
.
find
(
IssuableTitle
).
text
()).
toContain
(
'
One
'
);
});
it
(
'
renders
IssuableAssignees
'
,
()
=>
{
it
(
'
renders
BoardAssigneeDropdown
'
,
()
=>
{
expect
(
wrapper
.
find
(
BoardAssigneeDropdown
).
exists
()).
toBe
(
true
);
});
...
...
spec/frontend/boards/components/board_assignee_dropdown_spec.js
View file @
0e274436
import
{
mount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
GlDropdownItem
,
GlAvatarLink
,
GlAvatarLabeled
,
GlSearchBoxByType
}
from
'
@gitlab/ui
'
;
import
{
GlDropdownItem
,
GlAvatarLink
,
GlAvatarLabeled
,
GlSearchBoxByType
,
GlLoadingIcon
,
}
from
'
@gitlab/ui
'
;
import
createMockApollo
from
'
jest/helpers/mock_apollo_helper
'
;
import
VueApollo
from
'
vue-apollo
'
;
import
BoardAssigneeDropdown
from
'
~/boards/components/board_assignee_dropdown.vue
'
;
...
...
@@ -25,7 +31,7 @@ describe('BoardCardAssigneeDropdown', () => {
const
activeIssueName
=
'
test
'
;
const
anotherIssueName
=
'
hello
'
;
const
createComponent
=
(
search
=
''
)
=>
{
const
createComponent
=
(
search
=
''
,
loading
=
false
)
=>
{
wrapper
=
mount
(
BoardAssigneeDropdown
,
{
data
()
{
return
{
...
...
@@ -39,6 +45,15 @@ describe('BoardCardAssigneeDropdown', () => {
canUpdate
:
true
,
rootPath
:
''
,
},
mocks
:
{
$apollo
:
{
queries
:
{
participants
:
{
loading
,
},
},
},
},
});
};
...
...
@@ -82,6 +97,8 @@ describe('BoardCardAssigneeDropdown', () => {
return
wrapper
.
findAll
(
GlDropdownItem
).
wrappers
.
find
(
node
=>
node
.
text
().
indexOf
(
text
)
===
0
);
};
const
findLoadingIcon
=
()
=>
wrapper
.
find
(
GlLoadingIcon
);
beforeEach
(()
=>
{
store
.
state
.
activeId
=
'
1
'
;
store
.
state
.
issues
=
{
...
...
@@ -243,6 +260,30 @@ describe('BoardCardAssigneeDropdown', () => {
},
);
describe
(
'
when participants is loading
'
,
()
=>
{
beforeEach
(()
=>
{
createComponent
(
''
,
true
);
});
it
(
'
finds a loading icon in the dropdown
'
,
()
=>
{
expect
(
findLoadingIcon
().
exists
()).
toBe
(
true
);
});
});
describe
(
'
when participants is loading is false
'
,
()
=>
{
beforeEach
(()
=>
{
createComponent
();
});
it
(
'
does not find GlLoading icon in the dropdown
'
,
()
=>
{
expect
(
findLoadingIcon
().
exists
()).
toBe
(
false
);
});
it
(
'
finds at least 1 GlDropdownItem
'
,
()
=>
{
expect
(
wrapper
.
findAll
(
GlDropdownItem
).
length
).
toBeGreaterThan
(
0
);
});
});
describe
(
'
Apollo
'
,
()
=>
{
beforeEach
(()
=>
{
getIssueParticipantsSpy
=
jest
.
fn
().
mockResolvedValue
({
...
...
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