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
be9e8c53
Commit
be9e8c53
authored
Jul 17, 2020
by
Axel García
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Propagate label selector click when embedded
parent
0b0080f1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
5 deletions
+14
-5
app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/dropdown_button.vue
.../components/sidebar/labels_select_vue/dropdown_button.vue
+7
-3
spec/frontend/vue_shared/components/sidebar/labels_select_vue/dropdown_button_spec.js
...ponents/sidebar/labels_select_vue/dropdown_button_spec.js
+7
-2
No files found.
app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/dropdown_button.vue
View file @
be9e8c53
<
script
>
<
script
>
import
{
mapActions
,
mapGetters
}
from
'
vuex
'
;
import
{
mapActions
,
mapGetters
,
mapState
}
from
'
vuex
'
;
import
{
GlButton
,
GlIcon
}
from
'
@gitlab/ui
'
;
import
{
GlButton
,
GlIcon
}
from
'
@gitlab/ui
'
;
export
default
{
export
default
{
...
@@ -8,6 +8,7 @@ export default {
...
@@ -8,6 +8,7 @@ export default {
GlIcon
,
GlIcon
,
},
},
computed
:
{
computed
:
{
...
mapState
([
'
showDropdownContents
'
]),
...
mapGetters
([
...
mapGetters
([
'
dropdownButtonText
'
,
'
dropdownButtonText
'
,
'
isDropdownVariantStandalone
'
,
'
isDropdownVariantStandalone
'
,
...
@@ -19,6 +20,9 @@ export default {
...
@@ -19,6 +20,9 @@ export default {
handleButtonClick
(
e
)
{
handleButtonClick
(
e
)
{
if
(
this
.
isDropdownVariantStandalone
||
this
.
isDropdownVariantEmbedded
)
{
if
(
this
.
isDropdownVariantStandalone
||
this
.
isDropdownVariantEmbedded
)
{
this
.
toggleDropdownContents
();
this
.
toggleDropdownContents
();
}
if
(
this
.
isDropdownVariantStandalone
)
{
e
.
stopPropagation
();
e
.
stopPropagation
();
}
}
},
},
...
@@ -31,9 +35,9 @@ export default {
...
@@ -31,9 +35,9 @@ export default {
class=
"labels-select-dropdown-button js-dropdown-button w-100 text-left"
class=
"labels-select-dropdown-button js-dropdown-button w-100 text-left"
@
click=
"handleButtonClick"
@
click=
"handleButtonClick"
>
>
<span
class=
"dropdown-toggle-text flex-fill"
>
<span
class=
"dropdown-toggle-text
gl-pointer-events-none
flex-fill"
>
{{
dropdownButtonText
}}
{{
dropdownButtonText
}}
</span>
</span>
<gl-icon
name=
"chevron-down"
class=
"float-right"
/>
<gl-icon
name=
"chevron-down"
class=
"
gl-pointer-events-none
float-right"
/>
</gl-button>
</gl-button>
</
template
>
</
template
>
spec/frontend/vue_shared/components/sidebar/labels_select_vue/dropdown_button_spec.js
View file @
be9e8c53
...
@@ -45,7 +45,7 @@ describe('DropdownButton', () => {
...
@@ -45,7 +45,7 @@ describe('DropdownButton', () => {
${
'
standalone
'
}
${
'
standalone
'
}
${
'
embedded
'
}
${
'
embedded
'
}
`
(
`
(
'
toggles dropdown content and
stop
s event propagation when `state.variant` is "$variant"
'
,
'
toggles dropdown content and
handle
s event propagation when `state.variant` is "$variant"
'
,
({
variant
})
=>
{
({
variant
})
=>
{
const
event
=
{
stopPropagation
:
jest
.
fn
()
};
const
event
=
{
stopPropagation
:
jest
.
fn
()
};
...
@@ -57,7 +57,12 @@ describe('DropdownButton', () => {
...
@@ -57,7 +57,12 @@ describe('DropdownButton', () => {
findDropdownButton
().
vm
.
$emit
(
'
click
'
,
event
);
findDropdownButton
().
vm
.
$emit
(
'
click
'
,
event
);
expect
(
store
.
state
.
showDropdownContents
).
toBe
(
true
);
expect
(
store
.
state
.
showDropdownContents
).
toBe
(
true
);
expect
(
event
.
stopPropagation
).
toHaveBeenCalled
();
if
(
variant
===
'
standalone
'
)
{
expect
(
event
.
stopPropagation
).
toHaveBeenCalled
();
}
else
{
expect
(
event
.
stopPropagation
).
not
.
toHaveBeenCalled
();
}
},
},
);
);
});
});
...
...
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