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
ef1934af
Commit
ef1934af
authored
Jan 24, 2022
by
sstern
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add guard to milestone_token for sort
parent
9667a0aa
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
3 deletions
+33
-3
app/assets/javascripts/boards/components/issue_board_filtered_search.vue
...scripts/boards/components/issue_board_filtered_search.vue
+1
-0
app/assets/javascripts/vue_shared/components/filtered_search_bar/tokens/milestone_token.vue
...components/filtered_search_bar/tokens/milestone_token.vue
+6
-1
ee/spec/frontend/boards/mock_data.js
ee/spec/frontend/boards/mock_data.js
+1
-0
spec/frontend/boards/mock_data.js
spec/frontend/boards/mock_data.js
+1
-0
spec/frontend/vue_shared/components/filtered_search_bar/tokens/milestone_token_spec.js
...onents/filtered_search_bar/tokens/milestone_token_spec.js
+24
-2
No files found.
app/assets/javascripts/boards/components/issue_board_filtered_search.vue
View file @
ef1934af
...
...
@@ -157,6 +157,7 @@ export default {
symbol
:
'
%
'
,
token
:
MilestoneToken
,
unique
:
true
,
shouldSkipSort
:
true
,
fetchMilestones
:
this
.
fetchMilestones
,
},
{
...
...
app/assets/javascripts/vue_shared/components/filtered_search_bar/tokens/milestone_token.vue
View file @
ef1934af
...
...
@@ -57,7 +57,12 @@ export default {
.
fetchMilestones
(
searchTerm
)
.
then
((
response
)
=>
{
const
data
=
Array
.
isArray
(
response
)
?
response
:
response
.
data
;
this
.
milestones
=
data
.
slice
().
sort
(
sortMilestonesByDueDate
);
if
(
this
.
config
.
shouldSkipSort
)
{
this
.
milestones
=
data
;
}
else
{
this
.
milestones
=
data
.
slice
().
sort
(
sortMilestonesByDueDate
);
}
})
.
catch
(()
=>
{
createFlash
({
message
:
__
(
'
There was a problem fetching milestones.
'
)
});
...
...
ee/spec/frontend/boards/mock_data.js
View file @
ef1934af
...
...
@@ -474,6 +474,7 @@ export const mockTokens = (fetchLabels, fetchAuthors, fetchMilestones, fetchIter
symbol
:
'
%
'
,
type
:
'
milestone
'
,
token
:
MilestoneToken
,
shouldSkipSort
:
true
,
unique
:
true
,
fetchMilestones
,
},
...
...
spec/frontend/boards/mock_data.js
View file @
ef1934af
...
...
@@ -612,6 +612,7 @@ export const mockTokens = (fetchLabels, fetchAuthors, fetchMilestones, isSignedI
title
:
__
(
'
Milestone
'
),
symbol
:
'
%
'
,
type
:
'
milestone
'
,
shouldSkipSort
:
true
,
token
:
MilestoneToken
,
unique
:
true
,
fetchMilestones
,
...
...
spec/frontend/vue_shared/components/filtered_search_bar/tokens/milestone_token_spec.js
View file @
ef1934af
...
...
@@ -32,7 +32,7 @@ const defaultStubs = {
function
createComponent
(
options
=
{})
{
const
{
config
=
mockMilestoneToken
,
config
=
{
...
mockMilestoneToken
,
shouldSkipSort
:
true
}
,
value
=
{
data
:
''
},
active
=
false
,
stubs
=
defaultStubs
,
...
...
@@ -68,6 +68,27 @@ describe('MilestoneToken', () => {
describe
(
'
methods
'
,
()
=>
{
describe
(
'
fetchMilestones
'
,
()
=>
{
describe
(
'
when config.shouldSkipSort is true
'
,
()
=>
{
beforeEach
(()
=>
{
wrapper
.
vm
.
config
.
shouldSkipSort
=
true
;
});
afterEach
(()
=>
{
wrapper
.
vm
.
config
.
shouldSkipSort
=
false
;
});
it
(
'
does not call sortMilestonesByDueDate
'
,
async
()
=>
{
jest
.
spyOn
(
wrapper
.
vm
.
config
,
'
fetchMilestones
'
).
mockResolvedValue
({
data
:
mockMilestones
,
});
wrapper
.
vm
.
fetchMilestones
();
await
waitForPromises
();
expect
(
sortMilestonesByDueDate
).
toHaveBeenCalledTimes
(
0
);
});
});
it
(
'
calls `config.fetchMilestones` with provided searchTerm param
'
,
()
=>
{
jest
.
spyOn
(
wrapper
.
vm
.
config
,
'
fetchMilestones
'
);
...
...
@@ -77,10 +98,11 @@ describe('MilestoneToken', () => {
});
it
(
'
sets response to `milestones` when request is successful
'
,
()
=>
{
wrapper
.
vm
.
config
.
shouldSkipSort
=
false
;
jest
.
spyOn
(
wrapper
.
vm
.
config
,
'
fetchMilestones
'
).
mockResolvedValue
({
data
:
mockMilestones
,
});
wrapper
.
vm
.
fetchMilestones
();
return
waitForPromises
().
then
(()
=>
{
...
...
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