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
be8c4af8
Commit
be8c4af8
authored
Jan 17, 2018
by
Winnie Hellmann
Committed by
Clement Ho
Jan 17, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Filter groups and projects dropdowns of search page on backend
parent
5392568e
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
65 additions
and
0 deletions
+65
-0
app/assets/javascripts/pages/search/show/search.js
app/assets/javascripts/pages/search/show/search.js
+2
-0
changelogs/unreleased/winh-search-page-filters.yml
changelogs/unreleased/winh-search-page-filters.yml
+5
-0
spec/javascripts/fixtures/search.rb
spec/javascripts/fixtures/search.rb
+18
-0
spec/javascripts/search_spec.js
spec/javascripts/search_spec.js
+40
-0
No files found.
app/assets/javascripts/pages/search/show/search.js
View file @
be8c4af8
...
@@ -15,6 +15,7 @@ export default class Search {
...
@@ -15,6 +15,7 @@ export default class Search {
$groupDropdown
.
glDropdown
({
$groupDropdown
.
glDropdown
({
selectable
:
true
,
selectable
:
true
,
filterable
:
true
,
filterable
:
true
,
filterRemote
:
true
,
fieldName
:
'
group_id
'
,
fieldName
:
'
group_id
'
,
search
:
{
search
:
{
fields
:
[
'
full_name
'
],
fields
:
[
'
full_name
'
],
...
@@ -43,6 +44,7 @@ export default class Search {
...
@@ -43,6 +44,7 @@ export default class Search {
$projectDropdown
.
glDropdown
({
$projectDropdown
.
glDropdown
({
selectable
:
true
,
selectable
:
true
,
filterable
:
true
,
filterable
:
true
,
filterRemote
:
true
,
fieldName
:
'
project_id
'
,
fieldName
:
'
project_id
'
,
search
:
{
search
:
{
fields
:
[
'
name
'
],
fields
:
[
'
name
'
],
...
...
changelogs/unreleased/winh-search-page-filters.yml
0 → 100644
View file @
be8c4af8
---
title
:
Filter groups and projects dropdowns of search page on backend
merge_request
:
16336
author
:
type
:
fixed
spec/javascripts/fixtures/search.rb
0 → 100644
View file @
be8c4af8
require
'spec_helper'
describe
SearchController
,
'(JavaScript fixtures)'
,
type: :controller
do
include
JavaScriptFixturesHelpers
render_views
before
(
:all
)
do
clean_frontend_fixtures
(
'search/'
)
end
it
'search/show.html.raw'
do
|
example
|
get
:show
expect
(
response
).
to
be_success
store_frontend_fixture
(
response
,
example
.
description
)
end
end
spec/javascripts/search_spec.js
0 → 100644
View file @
be8c4af8
import
Api
from
'
~/api
'
;
import
Search
from
'
~/pages/search/show/search
'
;
describe
(
'
Search
'
,
()
=>
{
const
fixturePath
=
'
search/show.html.raw
'
;
const
searchTerm
=
'
some search
'
;
const
fillDropdownInput
=
(
dropdownSelector
)
=>
{
const
dropdownElement
=
document
.
querySelector
(
dropdownSelector
).
parentNode
;
const
inputElement
=
dropdownElement
.
querySelector
(
'
.dropdown-input-field
'
);
inputElement
.
value
=
searchTerm
;
return
inputElement
;
};
preloadFixtures
(
fixturePath
);
beforeEach
(()
=>
{
loadFixtures
(
fixturePath
);
new
Search
();
// eslint-disable-line no-new
});
it
(
'
requests groups from backend when filtering
'
,
(
done
)
=>
{
spyOn
(
Api
,
'
groups
'
).
and
.
callFake
((
term
)
=>
{
expect
(
term
).
toBe
(
searchTerm
);
done
();
});
const
inputElement
=
fillDropdownInput
(
'
.js-search-group-dropdown
'
);
$
(
inputElement
).
trigger
(
'
input
'
);
});
it
(
'
requests projects from backend when filtering
'
,
(
done
)
=>
{
spyOn
(
Api
,
'
projects
'
).
and
.
callFake
((
term
)
=>
{
expect
(
term
).
toBe
(
searchTerm
);
done
();
});
const
inputElement
=
fillDropdownInput
(
'
.js-search-project-dropdown
'
);
$
(
inputElement
).
trigger
(
'
input
'
);
});
});
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