From 9f779b36a87f5a885831e26837451c7af81ca5bd Mon Sep 17 00:00:00 2001 From: Dennis Shtatnov Date: Sat, 15 Dec 2018 11:02:14 -0500 Subject: [PATCH] fix(extension-registering) removeExtension implementation --- src/converter.js | 6 +++--- test/unit/showdown.Converter.js | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/converter.js b/src/converter.js index 06550fa..983e648 100644 --- a/src/converter.js +++ b/src/converter.js @@ -532,12 +532,12 @@ showdown.Converter = function (converterOptions) { var ext = extension[a]; for (var i = 0; i < langExtensions.length; ++i) { if (langExtensions[i] === ext) { - langExtensions[i].splice(i, 1); + langExtensions.splice(i, 1); } } - for (var ii = 0; ii < outputModifiers.length; ++i) { + for (var ii = 0; ii < outputModifiers.length; ++ii) { if (outputModifiers[ii] === ext) { - outputModifiers[ii].splice(i, 1); + outputModifiers.splice(ii, 1); } } } diff --git a/test/unit/showdown.Converter.js b/test/unit/showdown.Converter.js index b6ee9ee..0b8c7e0 100644 --- a/test/unit/showdown.Converter.js +++ b/test/unit/showdown.Converter.js @@ -122,6 +122,14 @@ describe('showdown.Converter', function () { converter.getAllExtensions().language.should.contain(extObjMock); showdown.resetExtensions(); }); + + it('removeExtension() should remove an added extension', function () { + var converter = new showdown.Converter(); + converter.addExtension(extObjMock); + + converter.removeExtension(extObjMock); + converter.getAllExtensions().language.should.not.contain(extObjMock); + }); }); describe('events', function () {