mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
Merge pull request #7586 from ycombinator/management/add-deregister-method
Adding method to deregister a (child) section
This commit is contained in:
commit
ce9efff511
2 changed files with 30 additions and 0 deletions
|
@ -58,6 +58,27 @@ describe('ManagementSection', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('deregister', () => {
|
||||
let section;
|
||||
|
||||
beforeEach(() => {
|
||||
section = new ManagementSection('kibana');
|
||||
section.register('about');
|
||||
});
|
||||
|
||||
it ('deregisters an existing section', () => {
|
||||
section.deregister('about');
|
||||
expect(section.items).to.have.length(0);
|
||||
});
|
||||
|
||||
it ('allows deregistering a section more than once', () => {
|
||||
section.deregister('about');
|
||||
section.deregister('about');
|
||||
expect(section.items).to.have.length(0);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('getSection', () => {
|
||||
let section;
|
||||
|
||||
|
|
|
@ -44,6 +44,15 @@ export default class ManagementSection {
|
|||
return item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deregisters a section
|
||||
*
|
||||
* @param {string} id
|
||||
*/
|
||||
deregister(id) {
|
||||
this.items.remove(item => item.id === id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if an id is already registered
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue