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
20f932d7
Commit
20f932d7
authored
Jul 25, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed issue with autocomplete search not working with enter key
Closes #20165
parent
580f5aa2
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
6 deletions
+21
-6
app/assets/javascripts/gl_dropdown.js.coffee
app/assets/javascripts/gl_dropdown.js.coffee
+10
-6
app/assets/javascripts/search_autocomplete.js.coffee
app/assets/javascripts/search_autocomplete.js.coffee
+1
-0
spec/features/search_spec.rb
spec/features/search_spec.rb
+10
-0
No files found.
app/assets/javascripts/gl_dropdown.js.coffee
View file @
20f932d7
...
...
@@ -218,12 +218,15 @@ class GitLabDropdown
if
@
dropdown
.
find
(
'.dropdown-toggle-page'
).
length
selector
=
".dropdown-page-one
#{
selector
}
"
if
not
$
(
@
el
).
is
(
'input'
)
$
(
selector
,
@
dropdown
)
.
first
()
.
find
(
'a'
)
.
addClass
(
'is-focused'
)
currentIndex
=
0
else
currentIndex
=
-
1
# Event listeners
...
...
@@ -559,10 +562,11 @@ class GitLabDropdown
# simulate a click on the first link
$el
=
$
(
selector
,
@
dropdown
)
if
$el
.
length
if
$el
.
length
and
currentIndex
>
-
1
e
.
preventDefault
()
e
.
stopImmediatePropagation
()
$el
.
first
().
trigger
(
'click'
)
$el
.
first
().
get
(
0
).
click
?
()
addArrowKeyEvent
:
->
ARROW_KEY_CODES
=
[
38
,
40
]
...
...
app/assets/javascripts/search_autocomplete.js.coffee
View file @
20f932d7
...
...
@@ -63,6 +63,7 @@ class @SearchAutocomplete
data
:
@
getData
.
bind
(
@
)
selectable
:
true
clicked
:
@
onClick
.
bind
(
@
)
id
:
(
data
)
->
_
.
escape
(
data
.
text
)
getData
:
(
term
,
callback
)
->
_this
=
@
...
...
spec/features/search_spec.rb
View file @
20f932d7
...
...
@@ -51,6 +51,16 @@ describe "Search", feature: true do
end
describe
'Right header search field'
,
feature:
true
do
it
'allows enter key to search'
,
js:
true
do
visit
namespace_project_path
(
project
.
namespace
,
project
)
fill_in
'search'
,
with:
'gitlab'
find
(
'#search'
).
native
.
send_keys
(
:enter
)
page
.
within
'.title'
do
expect
(
page
).
to
have_content
'Search'
end
end
describe
'Search in project page'
do
before
do
visit
namespace_project_path
(
project
.
namespace
,
project
)
...
...
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