mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
Allow setting a class for top nav items (#30103)
This commit is contained in:
parent
d64648641b
commit
8b8f4c50df
3 changed files with 17 additions and 1 deletions
|
@ -81,6 +81,9 @@ function getEditConfig(action) {
|
|||
defaultMessage: 'Switch to edit mode',
|
||||
}),
|
||||
testId: 'dashboardEditMode',
|
||||
// We want to hide the "edit" button on small screens, since those have a responsive
|
||||
// layout, which is not tied to the grid anymore, so we cannot edit the grid on that screens.
|
||||
className: 'eui-hideFor--s eui-hideFor--xs',
|
||||
run: action
|
||||
};
|
||||
}
|
||||
|
|
|
@ -72,4 +72,17 @@ describe('kbnTopNav directive', function () {
|
|||
const { $scope } = build({ controller }, { config: 'controller' });
|
||||
expect($scope.kbnTopNav).to.be(controller);
|
||||
});
|
||||
|
||||
it('should allow setting CSS classes via className', () => {
|
||||
const scope = {
|
||||
config: [
|
||||
{ key: 'foo', testId: 'foo', className: 'fooClass' },
|
||||
{ key: 'test', testId: 'test', className: 'class1 class2' },
|
||||
],
|
||||
};
|
||||
const { $el } = build(scope, { config: 'config' });
|
||||
expect($el.find('[data-test-subj="foo"]').hasClass('fooClass')).to.be(true);
|
||||
expect($el.find('[data-test-subj="test"]').hasClass('class1')).to.be(true);
|
||||
expect($el.find('[data-test-subj="test"]').hasClass('class2')).to.be(true);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
<div class="kuiLocalMenu kbnTopNav__mainMenu" ng-if="kbnTopNav.menuItems.length">
|
||||
<button
|
||||
class="kuiLocalMenuItem"
|
||||
class="kuiLocalMenuItem {{menuItem.className}}"
|
||||
ng-repeat="menuItem in kbnTopNav.menuItems"
|
||||
aria-label="{{::menuItem.description}}"
|
||||
aria-haspopup="{{!menuItem.hasFunction}}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue