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
Léo-Paul Géneau
gitlab-ce
Commits
2f57341b
Commit
2f57341b
authored
Apr 09, 2018
by
Kushal Pandya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Emit `toggleCollapse`, `onDropdownClose` on component
parent
a0116677
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
1 deletion
+29
-1
app/assets/javascripts/vue_shared/components/sidebar/labels_select/base.vue
...ipts/vue_shared/components/sidebar/labels_select/base.vue
+13
-1
spec/javascripts/vue_shared/components/sidebar/labels_select/base_spec.js
.../vue_shared/components/sidebar/labels_select/base_spec.js
+16
-0
No files found.
app/assets/javascripts/vue_shared/components/sidebar/labels_select/base.vue
View file @
2f57341b
<
script
>
import
$
from
'
jquery
'
;
import
{
__
}
from
'
~/locale
'
;
import
LabelsSelect
from
'
~/labels_select
'
;
import
LoadingIcon
from
'
../../loading_icon.vue
'
;
...
...
@@ -98,11 +99,18 @@ export default {
this
.
labelsDropdown
=
new
LabelsSelect
(
this
.
$refs
.
dropdownButton
,
{
handleClick
:
this
.
handleClick
,
});
$
(
this
.
$refs
.
dropdown
).
on
(
'
hidden.gl.dropdown
'
,
this
.
handleDropdownHidden
);
},
methods
:
{
handleClick
(
label
)
{
this
.
$emit
(
'
onLabelClick
'
,
label
);
},
handleCollapsedValueClick
()
{
this
.
$emit
(
'
toggleCollapse
'
);
},
handleDropdownHidden
()
{
this
.
$emit
(
'
onDropdownClose
'
);
},
},
};
</
script
>
...
...
@@ -112,6 +120,7 @@ export default {
<dropdown-value-collapsed
v-if=
"showCreate"
:labels=
"context.labels"
@
onValueClick=
"handleCollapsedValueClick"
/>
<dropdown-title
:can-edit=
"canEdit"
...
...
@@ -133,7 +142,10 @@ export default {
:name=
"hiddenInputName"
:label=
"label"
/>
<div
class=
"dropdown"
>
<div
class=
"dropdown"
ref=
"dropdown"
>
<dropdown-button
:ability-name=
"abilityName"
:field-name=
"hiddenInputName"
...
...
spec/javascripts/vue_shared/components/sidebar/labels_select/base_spec.js
View file @
2f57341b
...
...
@@ -73,6 +73,22 @@ describe('BaseComponent', () => {
expect
(
vm
.
$emit
).
toHaveBeenCalledWith
(
'
onLabelClick
'
,
mockLabels
[
0
]);
});
});
describe
(
'
handleCollapsedValueClick
'
,
()
=>
{
it
(
'
emits toggleCollapse event on component
'
,
()
=>
{
spyOn
(
vm
,
'
$emit
'
);
vm
.
handleCollapsedValueClick
();
expect
(
vm
.
$emit
).
toHaveBeenCalledWith
(
'
toggleCollapse
'
);
});
});
describe
(
'
handleDropdownHidden
'
,
()
=>
{
it
(
'
emits onDropdownClose event on component
'
,
()
=>
{
spyOn
(
vm
,
'
$emit
'
);
vm
.
handleDropdownHidden
();
expect
(
vm
.
$emit
).
toHaveBeenCalledWith
(
'
onDropdownClose
'
);
});
});
});
describe
(
'
mounted
'
,
()
=>
{
...
...
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