Commit f91fd18f authored by Luke Bennett's avatar Luke Bennett

Improved spec, waiting on sprockets-es6 to work with rspec....

parent dcf09a53
......@@ -4,18 +4,19 @@
/*= require lib/utils/common_utils */
/*= 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 FOCUSED_ITEM_SELECTOR = `${ITEM_SELECTOR} a.is-focused`;
(() => {
const NON_SELECTABLE_CLASSES = '.divider, .separator, .dropdown-header, .dropdown-menu-empty-link';
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,
UP: 38,
ENTER: 13,
ESC: 27
};
};
var navigateWithKeys = function navigateWithKeys(direction, steps, cb, i) {
var navigateWithKeys = function navigateWithKeys(direction, steps, cb, i) {
i = i || 0;
$('body').trigger({
type: 'keydown',
......@@ -28,9 +29,9 @@ var navigateWithKeys = function navigateWithKeys(direction, steps, cb, i) {
} else {
cb();
}
};
};
var initDropdown = function initDropdown() {
var initDropdown = function initDropdown() {
this.dropdownContainerElement = $('.dropdown.inline');
this.dropdownMenuElement = $('.dropdown-menu', this.dropdownContainerElement);
this.projectsData = fixture.load('projects.json')[0];
......@@ -44,9 +45,9 @@ var initDropdown = function initDropdown() {
project.id
}
});
};
};
describe('Dropdown', function describeDropdown() {
describe('Dropdown', function describeDropdown() {
fixture.preload('gl_dropdown.html');
fixture.preload('projects.json');
......@@ -117,4 +118,5 @@ describe('Dropdown', function describeDropdown() {
expect(this.dropdownContainerElement).not.toHaveClass('open');
});
});
});
});
})(window);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment