BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
148f4079
Commit
148f4079
authored
Nov 13, 2017
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '38075_allow_refernce_integer_labels' into 'master'
fix to allow integer label refernces See merge request gitlab-org/gitlab-ce!14607
parents
2e13dafb
d2d7bfa7
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
10 deletions
+38
-10
gfm_auto_complete.js
app/assets/javascripts/gfm_auto_complete.js
+2
-1
38075_allow_refernce_integer_labels.yml
...gelogs/unreleased/38075_allow_refernce_integer_labels.yml
+5
-0
gfm_autocomplete_spec.rb
spec/features/issues/gfm_autocomplete_spec.rb
+9
-9
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 @
148f4079
...
...
@@ -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 @
148f4079
---
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 @
148f4079
...
...
@@ -218,18 +218,18 @@ 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
)
expect
(
item
).
not_to
have_content
(
"
\"
#{
value
}
\"
"
)
def
expect_to_wrap
(
should_wrap
,
item
,
note
,
value
)
expect
(
item
).
to
have_content
(
value
)
expect
(
item
).
not_to
have_content
(
"
\"
#{
value
}
\"
"
)
item
.
click
item
.
click
if
should_wrap
expect
(
note
.
value
).
to
include
(
"
\"
#{
value
}
\"
"
)
else
expect
(
note
.
value
).
not_to
include
(
"
\"
#{
value
}
\"
"
)
end
if
should_wrap
expect
(
note
.
value
).
to
include
(
"
\"
#{
value
}
\"
"
)
else
expect
(
note
.
value
).
not_to
include
(
"
\"
#{
value
}
\"
"
)
end
end
end
spec/javascripts/gfm_auto_complete_spec.js
View file @
148f4079
...
...
@@ -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