From 01cf4c51582a677804d7f092c3d7a1f18596b7ce Mon Sep 17 00:00:00 2001 From: Shaunak Kashyap Date: Wed, 29 Jun 2016 15:49:47 -0700 Subject: [PATCH] Allow deregistering a section more than once --- src/ui/public/management/__tests__/section.js | 13 +++---------- src/ui/public/management/section.js | 3 --- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/src/ui/public/management/__tests__/section.js b/src/ui/public/management/__tests__/section.js index a44d08171da4f..43ded4bc3e9a0 100644 --- a/src/ui/public/management/__tests__/section.js +++ b/src/ui/public/management/__tests__/section.js @@ -76,17 +76,10 @@ describe('ManagementSection', () => { expect(section.items).to.have.length(0); }); - it ('can only deregister a section once', () => { - let threwException = false; + it ('allows deregistering a section more than once', () => { section.deregister('about'); - - try { - section.deregister('about'); - } catch (e) { - threwException = e.message.indexOf('is not registered') > -1; - } - - expect(threwException).to.be(true); + section.deregister('about'); + expect(section.items).to.have.length(0); }); }); diff --git a/src/ui/public/management/section.js b/src/ui/public/management/section.js index c17b0d99ae1d1..7d7d67d9a35a2 100644 --- a/src/ui/public/management/section.js +++ b/src/ui/public/management/section.js @@ -55,9 +55,6 @@ export default class ManagementSection { * @param {string} id */ deregister(id) { - if (!this.hasItem(id)) { - throw new Error(`'${id}' is not registered`); - } this.items.remove(item => item.id === id); }