John Cowen d1c879e06c
ui: Rework popover-menu auto closing (#8340)
* ui: Move more menu subcomponents deeper down into popovermenu

* ui: Simplify aria-menu component+remove auto menu close on route change

* Add ember-string-fns

* Use new PopoverMenu sub components and fix up tests

* Fix up wrong closing let

* Remove dcs from the service show page now we have it in the navigation
2020-08-10 09:26:02 +01:00

55 lines
1.5 KiB
JavaScript

export default (collection, clickable, attribute, is, authForm) => scope => {
const page = {
navigation: [
'services',
'nodes',
'kvs',
'acls',
'intentions',
'help',
'settings',
'auth',
].reduce(
function(prev, item, i, arr) {
const key = item;
return Object.assign({}, prev, {
[key]: clickable(`[data-test-main-nav-${item}] > *`),
});
},
{
scope: '[data-test-navigation]',
}
),
footer: ['copyright', 'docs'].reduce(
function(prev, item, i, arr) {
const key = item;
return Object.assign({}, prev, {
[key]: clickable(`[data-test-main-nav-${item}`),
});
},
{
scope: '[data-test-footer]',
}
),
authdialog: {
form: authForm(),
},
// TODO: errors aren't strictly part of this component
error: {
status: attribute('data-test-status', '[data-test-status]'),
},
};
page.navigation.login = clickable('[data-test-main-nav-auth] label');
page.navigation.dc = clickable('[data-test-datacenter-menu] button');
page.navigation.nspace = clickable('[data-test-nspace-menu] button');
page.navigation.manageNspaces = clickable('[data-test-main-nav-nspaces] a');
page.navigation.manageNspacesIsVisible = is(
':checked',
'[data-test-nspace-menu] > input[type="checkbox"]'
);
page.navigation.dcs = collection('[data-test-datacenter-picker]', {
name: clickable('a'),
});
return page;
};