mirror of
https://github.com/showdownjs/showdown.git
synced 2024-03-22 13:30:55 +08:00
fix(extension-registering) removeExtension implementation
This commit is contained in:
parent
005e83262c
commit
9f779b36a8
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 () {
|
||||
|
|
Loading…
Reference in New Issue
Block a user