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
8a645d43
Commit
8a645d43
authored
Dec 10, 2021
by
Florie Guibert
Committed by
Natalia Tepluhina
Dec 10, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Labels widget follow up
parent
14ab76f9
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
33 additions
and
22 deletions
+33
-22
app/assets/javascripts/vue_shared/components/sidebar/labels_select_widget/dropdown_contents.vue
...onents/sidebar/labels_select_widget/dropdown_contents.vue
+2
-2
app/assets/javascripts/vue_shared/components/sidebar/labels_select_widget/dropdown_header.vue
...mponents/sidebar/labels_select_widget/dropdown_header.vue
+10
-4
app/assets/javascripts/vue_shared/components/sidebar/labels_select_widget/labels_select_root.vue
...nents/sidebar/labels_select_widget/labels_select_root.vue
+1
-1
spec/frontend/vue_shared/components/sidebar/labels_select_widget/dropdown_contents_spec.js
...ts/sidebar/labels_select_widget/dropdown_contents_spec.js
+1
-13
spec/frontend/vue_shared/components/sidebar/labels_select_widget/dropdown_header_spec.js
...ents/sidebar/labels_select_widget/dropdown_header_spec.js
+17
-0
spec/frontend/vue_shared/components/sidebar/labels_select_widget/labels_select_root_spec.js
...s/sidebar/labels_select_widget/labels_select_root_spec.js
+2
-2
No files found.
app/assets/javascripts/vue_shared/components/sidebar/labels_select_widget/dropdown_contents.vue
View file @
8a645d43
...
@@ -195,12 +195,12 @@ export default {
...
@@ -195,12 +195,12 @@ export default {
>
>
<template
#header
>
<template
#header
>
<dropdown-header
<dropdown-header
v-if=
"!isStandalone"
ref=
"header"
ref=
"header"
v-model
=
"searchKey"
:search-key
=
"searchKey"
:labels-create-title=
"labelsCreateTitle"
:labels-create-title=
"labelsCreateTitle"
:labels-list-title=
"labelsListTitle"
:labels-list-title=
"labelsListTitle"
:show-dropdown-contents-create-view=
"showDropdownContentsCreateView"
:show-dropdown-contents-create-view=
"showDropdownContentsCreateView"
:is-standalone=
"isStandalone"
@
toggleDropdownContentsCreateView=
"toggleDropdownContent"
@
toggleDropdownContentsCreateView=
"toggleDropdownContent"
@
closeDropdown=
"$emit('closeDropdown')"
@
closeDropdown=
"$emit('closeDropdown')"
@
input=
"debouncedSearchKeyUpdate"
@
input=
"debouncedSearchKeyUpdate"
...
...
app/assets/javascripts/vue_shared/components/sidebar/labels_select_widget/dropdown_header.vue
View file @
8a645d43
...
@@ -6,9 +6,6 @@ export default {
...
@@ -6,9 +6,6 @@ export default {
GlButton
,
GlButton
,
GlSearchBoxByType
,
GlSearchBoxByType
,
},
},
model
:
{
prop
:
'
searchKey
'
,
},
props
:
{
props
:
{
labelsCreateTitle
:
{
labelsCreateTitle
:
{
type
:
String
,
type
:
String
,
...
@@ -31,6 +28,11 @@ export default {
...
@@ -31,6 +28,11 @@ export default {
type
:
String
,
type
:
String
,
required
:
true
,
required
:
true
,
},
},
isStandalone
:
{
type
:
Boolean
,
required
:
false
,
default
:
false
,
},
},
},
computed
:
{
computed
:
{
dropdownTitle
()
{
dropdownTitle
()
{
...
@@ -47,7 +49,11 @@ export default {
...
@@ -47,7 +49,11 @@ export default {
<
template
>
<
template
>
<div
data-testid=
"dropdown-header"
>
<div
data-testid=
"dropdown-header"
>
<div
class=
"dropdown-title gl-display-flex gl-align-items-center gl-pt-0 gl-pb-3!"
>
<div
v-if=
"!isStandalone"
class=
"dropdown-title gl-display-flex gl-align-items-center gl-pt-0 gl-pb-3!"
data-testid=
"dropdown-header-title"
>
<gl-button
<gl-button
v-if=
"showDropdownContentsCreateView"
v-if=
"showDropdownContentsCreateView"
:aria-label=
"__('Go back')"
:aria-label=
"__('Go back')"
...
...
app/assets/javascripts/vue_shared/components/sidebar/labels_select_widget/labels_select_root.vue
View file @
8a645d43
...
@@ -286,7 +286,7 @@ export default {
...
@@ -286,7 +286,7 @@ export default {
<
template
>
<
template
>
<div
<div
class=
"labels-select-wrapper
position
-relative"
class=
"labels-select-wrapper
gl
-relative"
:class=
"
{
:class=
"
{
'is-standalone': isDropdownVariantStandalone(variant),
'is-standalone': isDropdownVariantStandalone(variant),
'is-embedded': isDropdownVariantEmbedded(variant),
'is-embedded': isDropdownVariantEmbedded(variant),
...
...
spec/frontend/vue_shared/components/sidebar/labels_select_widget/dropdown_contents_spec.js
View file @
8a645d43
...
@@ -124,19 +124,7 @@ describe('DropdownContent', () => {
...
@@ -124,19 +124,7 @@ describe('DropdownContent', () => {
expect
(
wrapper
.
emitted
(
'
setLabels
'
)).
toEqual
([[[
updatedLabel
]]]);
expect
(
wrapper
.
emitted
(
'
setLabels
'
)).
toEqual
([[[
updatedLabel
]]]);
});
});
it
(
'
does not render header on standalone variant
'
,
()
=>
{
it
(
'
renders header
'
,
()
=>
{
createComponent
({
props
:
{
variant
:
DropdownVariant
.
Standalone
}
});
expect
(
findDropdownHeader
().
exists
()).
toBe
(
false
);
});
it
(
'
renders header on embedded variant
'
,
()
=>
{
createComponent
({
props
:
{
variant
:
DropdownVariant
.
Embedded
}
});
expect
(
findDropdownHeader
().
exists
()).
toBe
(
true
);
});
it
(
'
renders header on sidebar variant
'
,
()
=>
{
createComponent
();
createComponent
();
expect
(
findDropdownHeader
().
exists
()).
toBe
(
true
);
expect
(
findDropdownHeader
().
exists
()).
toBe
(
true
);
...
...
spec/frontend/vue_shared/components/sidebar/labels_select_widget/dropdown_header_spec.js
View file @
8a645d43
...
@@ -9,6 +9,7 @@ describe('DropdownHeader', () => {
...
@@ -9,6 +9,7 @@ describe('DropdownHeader', () => {
const
createComponent
=
({
const
createComponent
=
({
showDropdownContentsCreateView
=
false
,
showDropdownContentsCreateView
=
false
,
labelsFetchInProgress
=
false
,
labelsFetchInProgress
=
false
,
isStandalone
=
false
,
}
=
{})
=>
{
}
=
{})
=>
{
wrapper
=
extendedWrapper
(
wrapper
=
extendedWrapper
(
shallowMount
(
DropdownHeader
,
{
shallowMount
(
DropdownHeader
,
{
...
@@ -18,6 +19,7 @@ describe('DropdownHeader', () => {
...
@@ -18,6 +19,7 @@ describe('DropdownHeader', () => {
labelsCreateTitle
:
'
Create label
'
,
labelsCreateTitle
:
'
Create label
'
,
labelsListTitle
:
'
Select label
'
,
labelsListTitle
:
'
Select label
'
,
searchKey
:
''
,
searchKey
:
''
,
isStandalone
,
},
},
stubs
:
{
stubs
:
{
GlSearchBoxByType
,
GlSearchBoxByType
,
...
@@ -32,6 +34,7 @@ describe('DropdownHeader', () => {
...
@@ -32,6 +34,7 @@ describe('DropdownHeader', () => {
const
findSearchInput
=
()
=>
wrapper
.
findComponent
(
GlSearchBoxByType
);
const
findSearchInput
=
()
=>
wrapper
.
findComponent
(
GlSearchBoxByType
);
const
findGoBackButton
=
()
=>
wrapper
.
findByTestId
(
'
go-back-button
'
);
const
findGoBackButton
=
()
=>
wrapper
.
findByTestId
(
'
go-back-button
'
);
const
findDropdownTitle
=
()
=>
wrapper
.
findByTestId
(
'
dropdown-header-title
'
);
beforeEach
(()
=>
{
beforeEach
(()
=>
{
createComponent
();
createComponent
();
...
@@ -72,4 +75,18 @@ describe('DropdownHeader', () => {
...
@@ -72,4 +75,18 @@ describe('DropdownHeader', () => {
},
},
);
);
});
});
describe
(
'
Standalone variant
'
,
()
=>
{
beforeEach
(()
=>
{
createComponent
({
isStandalone
:
true
});
});
it
(
'
renders search input
'
,
()
=>
{
expect
(
findSearchInput
().
exists
()).
toBe
(
true
);
});
it
(
'
does not render title
'
,
async
()
=>
{
expect
(
findDropdownTitle
().
exists
()).
toBe
(
false
);
});
});
});
});
spec/frontend/vue_shared/components/sidebar/labels_select_widget/labels_select_root_spec.js
View file @
8a645d43
...
@@ -75,9 +75,9 @@ describe('LabelsSelectRoot', () => {
...
@@ -75,9 +75,9 @@ describe('LabelsSelectRoot', () => {
wrapper
.
destroy
();
wrapper
.
destroy
();
});
});
it
(
'
renders component with classes `labels-select-wrapper
position
-relative`
'
,
()
=>
{
it
(
'
renders component with classes `labels-select-wrapper
gl
-relative`
'
,
()
=>
{
createComponent
();
createComponent
();
expect
(
wrapper
.
classes
()).
toEqual
([
'
labels-select-wrapper
'
,
'
position
-relative
'
]);
expect
(
wrapper
.
classes
()).
toEqual
([
'
labels-select-wrapper
'
,
'
gl
-relative
'
]);
});
});
it
.
each
`
it
.
each
`
...
...
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