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
8d94a488
Commit
8d94a488
authored
Feb 09, 2021
by
Yogi
Committed by
Nicolò Maria Mezzopera
Feb 09, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Apply new GitLab UI for search in "frequent items search" dropdown
parent
41f7a751
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
30 deletions
+16
-30
app/assets/javascripts/frequent_items/components/frequent_items_search_input.vue
...frequent_items/components/frequent_items_search_input.vue
+3
-10
changelogs/unreleased/update-input.yml
changelogs/unreleased/update-input.yml
+5
-0
spec/frontend/frequent_items/components/frequent_items_search_input_spec.js
...uent_items/components/frequent_items_search_input_spec.js
+8
-20
No files found.
app/assets/javascripts/frequent_items/components/frequent_items_search_input.vue
View file @
8d94a488
<
script
>
<
script
>
import
{
debounce
}
from
'
lodash
'
;
import
{
debounce
}
from
'
lodash
'
;
import
{
mapActions
,
mapState
}
from
'
vuex
'
;
import
{
mapActions
,
mapState
}
from
'
vuex
'
;
import
{
Gl
Icon
}
from
'
@gitlab/ui
'
;
import
{
Gl
SearchBoxByType
}
from
'
@gitlab/ui
'
;
import
Tracking
from
'
~/tracking
'
;
import
Tracking
from
'
~/tracking
'
;
import
frequentItemsMixin
from
'
./frequent_items_mixin
'
;
import
frequentItemsMixin
from
'
./frequent_items_mixin
'
;
...
@@ -9,7 +9,7 @@ const trackingMixin = Tracking.mixin();
...
@@ -9,7 +9,7 @@ const trackingMixin = Tracking.mixin();
export
default
{
export
default
{
components
:
{
components
:
{
Gl
Icon
,
Gl
SearchBoxByType
,
},
},
mixins
:
[
frequentItemsMixin
,
trackingMixin
],
mixins
:
[
frequentItemsMixin
,
trackingMixin
],
data
()
{
data
()
{
...
@@ -33,22 +33,15 @@ export default {
...
@@ -33,22 +33,15 @@ export default {
},
},
methods
:
{
methods
:
{
...
mapActions
([
'
setSearchQuery
'
]),
...
mapActions
([
'
setSearchQuery
'
]),
setFocus
()
{
this
.
$refs
.
search
.
focus
();
},
},
},
};
};
</
script
>
</
script
>
<
template
>
<
template
>
<div
class=
"search-input-container d-none d-sm-block"
>
<div
class=
"search-input-container d-none d-sm-block"
>
<input
<gl-search-box-by-type
ref=
"search"
v-model=
"searchQuery"
v-model=
"searchQuery"
:placeholder=
"translations.searchInputPlaceholder"
:placeholder=
"translations.searchInputPlaceholder"
type=
"search"
class=
"form-control"
/>
/>
<gl-icon
v-if=
"!searchQuery"
name=
"search"
class=
"search-icon"
/>
</div>
</div>
</
template
>
</
template
>
changelogs/unreleased/update-input.yml
0 → 100644
View file @
8d94a488
---
title
:
Apply new GitLab UI for search in frequent items search
merge_request
:
53368
author
:
Yogi (@yo)
type
:
other
spec/frontend/frequent_items/components/frequent_items_search_input_spec.js
View file @
8d94a488
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
GlSearchBoxByType
}
from
'
@gitlab/ui
'
;
import
{
mockTracking
,
unmockTracking
}
from
'
helpers/tracking_helper
'
;
import
{
mockTracking
,
unmockTracking
}
from
'
helpers/tracking_helper
'
;
import
searchComponent
from
'
~/frequent_items/components/frequent_items_search_input.vue
'
;
import
searchComponent
from
'
~/frequent_items/components/frequent_items_search_input.vue
'
;
import
{
createStore
}
from
'
~/frequent_items/store
'
;
import
{
createStore
}
from
'
~/frequent_items/store
'
;
...
@@ -15,6 +16,8 @@ describe('FrequentItemsSearchInputComponent', () => {
...
@@ -15,6 +16,8 @@ describe('FrequentItemsSearchInputComponent', () => {
propsData
:
{
namespace
},
propsData
:
{
namespace
},
});
});
const
findSearchBoxByType
=
()
=>
wrapper
.
find
(
GlSearchBoxByType
);
beforeEach
(()
=>
{
beforeEach
(()
=>
{
store
=
createStore
({
dropdownType
:
'
project
'
});
store
=
createStore
({
dropdownType
:
'
project
'
});
jest
.
spyOn
(
store
,
'
dispatch
'
).
mockImplementation
(()
=>
{});
jest
.
spyOn
(
store
,
'
dispatch
'
).
mockImplementation
(()
=>
{});
...
@@ -32,26 +35,13 @@ describe('FrequentItemsSearchInputComponent', () => {
...
@@ -32,26 +35,13 @@ describe('FrequentItemsSearchInputComponent', () => {
vm
.
$destroy
();
vm
.
$destroy
();
});
});
describe
(
'
methods
'
,
()
=>
{
describe
(
'
setFocus
'
,
()
=>
{
it
(
'
should set focus to search input
'
,
()
=>
{
jest
.
spyOn
(
vm
.
$refs
.
search
,
'
focus
'
).
mockImplementation
(()
=>
{});
vm
.
setFocus
();
expect
(
vm
.
$refs
.
search
.
focus
).
toHaveBeenCalled
();
});
});
});
describe
(
'
template
'
,
()
=>
{
describe
(
'
template
'
,
()
=>
{
it
(
'
should render component element
'
,
()
=>
{
it
(
'
should render component element
'
,
()
=>
{
expect
(
wrapper
.
classes
()).
toContain
(
'
search-input-container
'
);
expect
(
wrapper
.
classes
()).
toContain
(
'
search-input-container
'
);
expect
(
wrapper
.
find
(
'
input.form-control
'
).
exists
()).
toBe
(
true
);
expect
(
findSearchBoxByType
().
exists
()).
toBe
(
true
);
expect
(
wrapper
.
find
(
'
.search-icon
'
).
exists
()).
toBe
(
true
);
expect
(
findSearchBoxByType
().
attributes
()).
toMatchObject
({
expect
(
wrapper
.
find
(
'
input.form-control
'
).
attributes
(
'
placeholder
'
)).
toBe
(
placeholder
:
'
Search your projects
'
,
'
Search your projects
'
,
});
);
});
});
});
});
...
@@ -62,9 +52,7 @@ describe('FrequentItemsSearchInputComponent', () => {
...
@@ -62,9 +52,7 @@ describe('FrequentItemsSearchInputComponent', () => {
const
value
=
'
my project
'
;
const
value
=
'
my project
'
;
const
input
=
wrapper
.
find
(
'
input
'
);
findSearchBoxByType
().
vm
.
$emit
(
'
input
'
,
value
);
input
.
setValue
(
value
);
input
.
trigger
(
'
input
'
);
await
wrapper
.
vm
.
$nextTick
();
await
wrapper
.
vm
.
$nextTick
();
...
...
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