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
f91fd18f
Commit
f91fd18f
authored
Jul 27, 2016
by
Luke Bennett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved spec, waiting on sprockets-es6 to work with rspec....
parent
dcf09a53
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
94 additions
and
92 deletions
+94
-92
spec/javascripts/gl_dropdown_spec.js.es6
spec/javascripts/gl_dropdown_spec.js.es6
+94
-92
No files found.
spec/javascripts/gl_dropdown_spec.js.es6
View file @
f91fd18f
...
@@ -4,18 +4,19 @@
...
@@ -4,18 +4,19 @@
/*= require lib/utils/common_utils */
/*= require lib/utils/common_utils */
/*= require lib/utils/type_utility */
/*= require lib/utils/type_utility */
const NON_SELECTABLE_CLASSES = '.divider, .separator, .dropdown-header, .dropdown-menu-empty-link';
(() => {
const ITEM_SELECTOR = `.dropdown-content li:not(${NON_SELECTABLE_CLASSES})`;
const NON_SELECTABLE_CLASSES = '.divider, .separator, .dropdown-header, .dropdown-menu-empty-link';
const FOCUSED_ITEM_SELECTOR = `${ITEM_SELECTOR} a.is-focused`;
const ITEM_SELECTOR = `.dropdown-content li:not(${NON_SELECTABLE_CLASSES})`;
const FOCUSED_ITEM_SELECTOR = `${ITEM_SELECTOR} a.is-focused`;
const ARROW_KEYS = {
const ARROW_KEYS = {
DOWN: 40,
DOWN: 40,
UP: 38,
UP: 38,
ENTER: 13,
ENTER: 13,
ESC: 27
ESC: 27
};
};
var navigateWithKeys = function navigateWithKeys(direction, steps, cb, i) {
var navigateWithKeys = function navigateWithKeys(direction, steps, cb, i) {
i = i || 0;
i = i || 0;
$('body').trigger({
$('body').trigger({
type: 'keydown',
type: 'keydown',
...
@@ -28,9 +29,9 @@ var navigateWithKeys = function navigateWithKeys(direction, steps, cb, i) {
...
@@ -28,9 +29,9 @@ var navigateWithKeys = function navigateWithKeys(direction, steps, cb, i) {
} else {
} else {
cb();
cb();
}
}
};
};
var initDropdown = function initDropdown() {
var initDropdown = function initDropdown() {
this.dropdownContainerElement = $('.dropdown.inline');
this.dropdownContainerElement = $('.dropdown.inline');
this.dropdownMenuElement = $('.dropdown-menu', this.dropdownContainerElement);
this.dropdownMenuElement = $('.dropdown-menu', this.dropdownContainerElement);
this.projectsData = fixture.load('projects.json')[0];
this.projectsData = fixture.load('projects.json')[0];
...
@@ -44,9 +45,9 @@ var initDropdown = function initDropdown() {
...
@@ -44,9 +45,9 @@ var initDropdown = function initDropdown() {
project.id
project.id
}
}
});
});
};
};
describe('Dropdown', function describeDropdown() {
describe('Dropdown', function describeDropdown() {
fixture.preload('gl_dropdown.html');
fixture.preload('gl_dropdown.html');
fixture.preload('projects.json');
fixture.preload('projects.json');
...
@@ -117,4 +118,5 @@ describe('Dropdown', function describeDropdown() {
...
@@ -117,4 +118,5 @@ describe('Dropdown', function describeDropdown() {
expect(this.dropdownContainerElement).not.toHaveClass('open');
expect(this.dropdownContainerElement).not.toHaveClass('open');
});
});
});
});
});
});
})(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