fix(extension-registering) removeExtension implementation

This commit is contained in:
Dennis Shtatnov 2018-12-15 11:02:14 -05:00 committed by SyntaxRules
parent 005e83262c
commit 9f779b36a8
2 changed files with 11 additions and 3 deletions

View File

@ -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);
}
}
}

View File

@ -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 () {