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
0
Merge Requests
0
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
Jérome Perrin
gitlab-ce
Commits
d2d7bfa7
Commit
d2d7bfa7
authored
Nov 13, 2017
by
haseeb
Committed by
Filipa Lacerda
Nov 13, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix to allow integer label refernces
parent
2e13dafb
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
10 deletions
+38
-10
app/assets/javascripts/gfm_auto_complete.js
app/assets/javascripts/gfm_auto_complete.js
+2
-1
changelogs/unreleased/38075_allow_refernce_integer_labels.yml
...gelogs/unreleased/38075_allow_refernce_integer_labels.yml
+5
-0
spec/features/issues/gfm_autocomplete_spec.rb
spec/features/issues/gfm_autocomplete_spec.rb
+9
-9
spec/javascripts/gfm_auto_complete_spec.js
spec/javascripts/gfm_auto_complete_spec.js
+22
-0
No files found.
app/assets/javascripts/gfm_auto_complete.js
View file @
d2d7bfa7
...
...
@@ -338,7 +338,8 @@ class GfmAutoComplete {
let
resultantValue
=
value
;
if
(
value
&&
!
this
.
setting
.
skipSpecialCharacterTest
)
{
const
withoutAt
=
value
.
substring
(
1
);
if
(
withoutAt
&&
/
[^\w\d]
/
.
test
(
withoutAt
))
{
const
regex
=
value
.
charAt
()
===
'
~
'
?
/
\W
|^
\d
+$/
:
/
\W
/
;
if
(
withoutAt
&&
regex
.
test
(
withoutAt
))
{
resultantValue
=
`
${
value
.
charAt
()}
"
${
withoutAt
}
"`
;
}
}
...
...
changelogs/unreleased/38075_allow_refernce_integer_labels.yml
0 → 100644
View file @
d2d7bfa7
---
title
:
Fix errors when selecting numeric-only labels in the labels autocomplete selector
merge_request
:
14607
author
:
haseebeqx
type
:
fixed
spec/features/issues/gfm_autocomplete_spec.rb
View file @
d2d7bfa7
...
...
@@ -218,6 +218,7 @@ feature 'GFM autocomplete', :js do
user_item
=
find
(
'.atwho-view li'
,
text:
user
.
username
)
expect
(
user_item
).
to
have_content
(
user
.
username
)
end
end
def
expect_to_wrap
(
should_wrap
,
item
,
note
,
value
)
expect
(
item
).
to
have_content
(
value
)
...
...
@@ -231,5 +232,4 @@ feature 'GFM autocomplete', :js do
expect
(
note
.
value
).
not_to
include
(
"
\"
#{
value
}
\"
"
)
end
end
end
end
spec/javascripts/gfm_auto_complete_spec.js
View file @
d2d7bfa7
...
...
@@ -67,6 +67,28 @@ describe('GfmAutoComplete', function () {
});
});
describe
(
'
DefaultOptions.beforeInsert
'
,
()
=>
{
const
beforeInsert
=
(
context
,
value
)
=>
(
gfmAutoCompleteCallbacks
.
beforeInsert
.
call
(
context
,
value
)
);
const
atwhoInstance
=
{
setting
:
{
skipSpecialCharacterTest
:
false
}
};
it
(
'
should not quote if value only contains alphanumeric charecters
'
,
()
=>
{
expect
(
beforeInsert
(
atwhoInstance
,
'
@user1
'
)).
toBe
(
'
@user1
'
);
expect
(
beforeInsert
(
atwhoInstance
,
'
~label1
'
)).
toBe
(
'
~label1
'
);
});
it
(
'
should quote if value contains any non-alphanumeric characters
'
,
()
=>
{
expect
(
beforeInsert
(
atwhoInstance
,
'
~label-20
'
)).
toBe
(
'
~"label-20"
'
);
expect
(
beforeInsert
(
atwhoInstance
,
'
~label 20
'
)).
toBe
(
'
~"label 20"
'
);
});
it
(
'
should quote integer labels
'
,
()
=>
{
expect
(
beforeInsert
(
atwhoInstance
,
'
~1234
'
)).
toBe
(
'
~"1234"
'
);
});
});
describe
(
'
DefaultOptions.matcher
'
,
function
()
{
const
defaultMatcher
=
(
context
,
flag
,
subtext
)
=>
(
gfmAutoCompleteCallbacks
.
matcher
.
call
(
context
,
flag
,
subtext
)
...
...
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