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
a3035888
Commit
a3035888
authored
Mar 27, 2018
by
bitsapien
Committed by
Clement Ho
Mar 27, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] Fixed bug in dropdown selector when selecting the same selection again
parent
c02089af
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
2 deletions
+33
-2
app/assets/javascripts/gl_dropdown.js
app/assets/javascripts/gl_dropdown.js
+1
-1
changelogs/unreleased/38167-ui-bug-when-creating-new-branch.yml
...logs/unreleased/38167-ui-bug-when-creating-new-branch.yml
+5
-0
spec/javascripts/fixtures/gl_dropdown.html.haml
spec/javascripts/fixtures/gl_dropdown.html.haml
+2
-1
spec/javascripts/gl_dropdown_spec.js
spec/javascripts/gl_dropdown_spec.js
+25
-0
No files found.
app/assets/javascripts/gl_dropdown.js
View file @
a3035888
...
@@ -753,7 +753,7 @@ GitLabDropdown = (function() {
...
@@ -753,7 +753,7 @@ GitLabDropdown = (function() {
}
}
if
(
this
.
options
.
isSelectable
&&
!
this
.
options
.
isSelectable
(
selectedObject
,
el
))
{
if
(
this
.
options
.
isSelectable
&&
!
this
.
options
.
isSelectable
(
selectedObject
,
el
))
{
return
;
return
[
selectedObject
]
;
}
}
if
(
el
.
hasClass
(
ACTIVE_CLASS
)
&&
value
!==
0
)
{
if
(
el
.
hasClass
(
ACTIVE_CLASS
)
&&
value
!==
0
)
{
...
...
changelogs/unreleased/38167-ui-bug-when-creating-new-branch.yml
0 → 100644
View file @
a3035888
---
title
:
Fixed bug in dropdown selector when selecting the same selection again
merge_request
:
14631
author
:
bitsapien
type
:
fixed
spec/javascripts/fixtures/gl_dropdown.html.haml
View file @
a3035888
%div
%div
.dropdown.inline
.dropdown.inline
%button
#js-project-dropdown
.dropdown-menu-toggle
{
type:
'button'
,
data:
{
toggle:
'dropdown'
}}
%button
#js-project-dropdown
.dropdown-menu-toggle
{
type:
'button'
,
data:
{
toggle:
'dropdown'
}}
Projects
.dropdown-toggle-text
Projects
%i
.fa.fa-chevron-down.dropdown-toggle-caret.js-projects-dropdown-toggle
%i
.fa.fa-chevron-down.dropdown-toggle-caret.js-projects-dropdown-toggle
.dropdown-menu.dropdown-select.dropdown-menu-selectable
.dropdown-menu.dropdown-select.dropdown-menu-selectable
.dropdown-title
.dropdown-title
...
...
spec/javascripts/gl_dropdown_spec.js
View file @
a3035888
...
@@ -256,4 +256,29 @@ describe('glDropdown', function describeDropdown() {
...
@@ -256,4 +256,29 @@ describe('glDropdown', function describeDropdown() {
});
});
});
});
});
});
it
(
'
should keep selected item after selecting a second time
'
,
()
=>
{
const
options
=
{
isSelectable
(
item
,
$el
)
{
return
!
$el
.
hasClass
(
'
is-active
'
);
},
toggleLabel
(
item
)
{
return
item
&&
item
.
id
;
},
};
initDropDown
.
call
(
this
,
false
,
false
,
options
);
const
$item
=
$
(
`
${
ITEM_SELECTOR
}
:first() a`
,
this
.
$dropdownMenuElement
);
// select item the first time
this
.
dropdownButtonElement
.
click
();
$item
.
click
();
expect
(
$item
).
toHaveClass
(
'
is-active
'
);
// select item the second time
this
.
dropdownButtonElement
.
click
();
$item
.
click
();
expect
(
$item
).
toHaveClass
(
'
is-active
'
);
expect
(
$
(
'
.dropdown-toggle-text
'
)).
toHaveText
(
this
.
projectsData
[
0
].
id
.
toString
());
});
});
});
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