Skip to content

Commit

Permalink
Allow deregistering a section more than once
Browse files Browse the repository at this point in the history
  • Loading branch information
ycombinator committed Jun 29, 2016
1 parent a9013a5 commit 01cf4c5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
13 changes: 3 additions & 10 deletions src/ui/public/management/__tests__/section.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});

});
Expand Down
3 changes: 0 additions & 3 deletions src/ui/public/management/section.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 01cf4c5

Please sign in to comment.