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
Boxiang Sun
gitlab-ce
Commits
49c7ca2a
Commit
49c7ca2a
authored
Jul 28, 2016
by
Luke Bennett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed spec and improved formatting
parent
f91fd18f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
31 deletions
+28
-31
app/assets/javascripts/gl_dropdown.js
app/assets/javascripts/gl_dropdown.js
+2
-2
app/assets/javascripts/search_autocomplete.js
app/assets/javascripts/search_autocomplete.js
+1
-1
spec/javascripts/gl_dropdown_spec.js.es6
spec/javascripts/gl_dropdown_spec.js.es6
+25
-28
No files found.
app/assets/javascripts/gl_dropdown.js
View file @
49c7ca2a
...
...
@@ -690,8 +690,8 @@
if
(
!
index
)
{
$dropdownContent
.
scrollTop
(
0
)
}
else
if
(
index
===
(
$listItems
.
length
-
1
))
{
$dropdownContent
.
scrollTop
$dropdownContent
.
prop
(
'
scrollHeight
'
);
}
else
if
(
listItemBottom
>
(
dropdownContentBottom
+
dropdownScrollTop
))
$dropdownContent
.
scrollTop
(
$dropdownContent
.
prop
(
'
scrollHeight
'
)
);
}
else
if
(
listItemBottom
>
(
dropdownContentBottom
+
dropdownScrollTop
))
{
$dropdownContent
.
scrollTop
(
listItemBottom
-
dropdownContentBottom
+
CURSOR_SELECT_SCROLL_PADDING
);
}
else
if
(
listItemTop
<
(
dropdownContentTop
+
dropdownScrollTop
))
{
return
$dropdownContent
.
scrollTop
(
listItemTop
-
dropdownContentTop
-
CURSOR_SELECT_SCROLL_PADDING
);
...
...
app/assets/javascripts/search_autocomplete.js
View file @
49c7ca2a
...
...
@@ -228,7 +228,7 @@
case
KEYCODE
.
ENTER
:
this
.
disableAutocomplete
();
break
;
case
KEYCODE
.
UP
,
case
KEYCODE
.
UP
:
case
KEYCODE
.
DOWN
:
return
;
default
:
...
...
spec/javascripts/gl_dropdown_spec.js.es6
View file @
49c7ca2a
...
...
@@ -16,12 +16,13 @@
ESC: 27
};
var
navigateWithKeys = function navigateWithKeys(direction, steps, cb, i) {
let
navigateWithKeys = function navigateWithKeys(direction, steps, cb, i) {
i = i || 0;
if (!i) direction = direction.toUpperCase();
$('body').trigger({
type: 'keydown',
which: ARROW_KEYS[direction
.toUpperCase()
],
keyCode: ARROW_KEYS[direction
.toUpperCase()
]
which: ARROW_KEYS[direction],
keyCode: ARROW_KEYS[direction]
});
i++;
if (i <= steps) {
...
...
@@ -31,7 +32,12 @@
}
};
var initDropdown = function initDropdown() {
describe('Dropdown', function describeDropdown() {
fixture.preload('gl_dropdown.html');
fixture.preload('projects.json');
beforeEach(() => {
fixture.load('gl_dropdown.html');
this.dropdownContainerElement = $('.dropdown.inline');
this.dropdownMenuElement = $('.dropdown-menu', this.dropdownContainerElement);
this.projectsData = fixture.load('projects.json')[0];
...
...
@@ -45,21 +51,12 @@
project.id
}
});
};
describe('Dropdown', function describeDropdown() {
fixture.preload('gl_dropdown.html');
fixture.preload('projects.json');
function beforeEach() {
fixture.load('gl_dropdown.html');
initDropdown.call(this);
}
});
function afterEach()
{
afterEach(() =>
{
$('body').unbind('keydown');
this.dropdownContainerElement.unbind('keyup');
}
}
);
it('should open on click', () => {
expect(this.dropdownContainerElement).not.toHaveClass('open');
...
...
@@ -67,10 +64,10 @@
expect(this.dropdownContainerElement).toHaveClass('open');
});
describe('that is open',
function describeThatIsOpen()
{
function beforeEach()
{
describe('that is open',
() =>
{
beforeEach(() =>
{
this.dropdownButtonElement.click();
}
}
);
it('should select a following item on DOWN keypress', () => {
expect($(FOCUSED_ITEM_SELECTOR, this.dropdownMenuElement).length).toBe(0);
...
...
@@ -119,4 +116,4 @@
});
});
});
})(
window
);
})();
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