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
77f63da4
Commit
77f63da4
authored
Feb 03, 2021
by
Rajat Jain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use reference for Epic in autocompletion
Use reference for Epics in autocompletion
parent
aba290fa
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
2 deletions
+27
-2
ee/app/assets/javascripts/gfm_auto_complete.js
ee/app/assets/javascripts/gfm_auto_complete.js
+3
-2
ee/changelogs/unreleased/issue_224176_fe.yml
ee/changelogs/unreleased/issue_224176_fe.yml
+5
-0
ee/spec/frontend/gfm_auto_complete_spec.js
ee/spec/frontend/gfm_auto_complete_spec.js
+19
-0
No files found.
ee/app/assets/javascripts/gfm_auto_complete.js
View file @
77f63da4
...
@@ -36,8 +36,8 @@ class GfmAutoCompleteEE extends GfmAutoComplete {
...
@@ -36,8 +36,8 @@ class GfmAutoCompleteEE extends GfmAutoComplete {
return
tmpl
;
return
tmpl
;
},
},
data
:
GfmAutoComplete
.
defaultLoadingData
,
data
:
GfmAutoComplete
.
defaultLoadingData
,
// eslint-disable-next-line no-template-curly-in-string
insertTpl
:
GfmAutoComplete
.
Issues
.
insertTemplateFunction
,
insertTpl
:
'
${atwho-at}${id}
'
,
skipSpecialCharacterTest
:
true
,
callbacks
:
{
callbacks
:
{
...
defaultCallbacks
,
...
defaultCallbacks
,
beforeSave
(
merges
)
{
beforeSave
(
merges
)
{
...
@@ -47,6 +47,7 @@ class GfmAutoCompleteEE extends GfmAutoComplete {
...
@@ -47,6 +47,7 @@ class GfmAutoCompleteEE extends GfmAutoComplete {
}
}
return
{
return
{
id
:
m
.
iid
,
id
:
m
.
iid
,
reference
:
m
.
reference
,
title
:
m
.
title
.
replace
(
/<
(?:
.|
\n)
*
?
>/gm
,
''
),
title
:
m
.
title
.
replace
(
/<
(?:
.|
\n)
*
?
>/gm
,
''
),
search
:
`
${
m
.
iid
}
${
m
.
title
}
`
,
search
:
`
${
m
.
iid
}
${
m
.
title
}
`
,
};
};
...
...
ee/changelogs/unreleased/issue_224176_fe.yml
0 → 100644
View file @
77f63da4
---
title
:
Fix Epic autocomplete reference
merge_request
:
52663
author
:
type
:
fixed
ee/spec/frontend/gfm_auto_complete_spec.js
View file @
77f63da4
import
$
from
'
jquery
'
;
import
$
from
'
jquery
'
;
import
GfmAutoCompleteEE
from
'
ee/gfm_auto_complete
'
;
import
GfmAutoCompleteEE
from
'
ee/gfm_auto_complete
'
;
import
{
TEST_HOST
}
from
'
helpers/test_constants
'
;
import
{
TEST_HOST
}
from
'
helpers/test_constants
'
;
import
GfmAutoComplete
from
'
~/gfm_auto_complete
'
;
describe
(
'
GfmAutoCompleteEE
'
,
()
=>
{
describe
(
'
GfmAutoCompleteEE
'
,
()
=>
{
const
dataSources
=
{
const
dataSources
=
{
...
@@ -17,4 +18,22 @@ describe('GfmAutoCompleteEE', () => {
...
@@ -17,4 +18,22 @@ describe('GfmAutoCompleteEE', () => {
it
(
'
should have enableMap
'
,
()
=>
{
it
(
'
should have enableMap
'
,
()
=>
{
expect
(
instance
.
enableMap
).
not
.
toBeNull
();
expect
(
instance
.
enableMap
).
not
.
toBeNull
();
});
});
describe
(
'
Issues.templateFunction
'
,
()
=>
{
it
(
'
should return html with id and title
'
,
()
=>
{
expect
(
GfmAutoComplete
.
Issues
.
templateFunction
({
id
:
42
,
title
:
'
Sample Epic
'
})).
toBe
(
'
<li><small>42</small> Sample Epic</li>
'
,
);
});
it
(
'
should replace id with reference if reference is set
'
,
()
=>
{
expect
(
GfmAutoComplete
.
Issues
.
templateFunction
({
id
:
42
,
title
:
'
Another Epic
'
,
reference
:
'
foo&42
'
,
}),
).
toBe
(
'
<li><small>foo&42</small> Another Epic</li>
'
);
});
});
});
});
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