showdown/test/node/legacyExtensionSupport.js
Estevao Soares dos Santos 4ebd0caa27 feature(extensionLoading): add support to legacy extensions in the new extension mechanism
Old extensions that register themselves in `showdown.extensions` can be loaded and validated using the new extension loading mechanism.
However, a warn is issued, alerting users and developers that the extension should be updated to use the new mechanism

BREAKING CHANGE: Deprecates `showdown.extensions` property. To migrate, you should use the new method `showdown.extension(<ext name>, <extension>)` to register the extension.
2015-06-07 19:02:45 +01:00

25 lines
660 B
JavaScript

/**
* Created by Estevao on 06-06-2015.
*/
require('source-map-support').install();
var expect = require('chai').expect,
showdown = require('../../dist/showdown.js');
describe('showdown legacy extension support', function () {
'use strict';
var extObjMock =
{
type: 'lang',
filter: function () {}
},
extFunc = function () {
return [extObjMock];
};
it('accept extensions loaded by the old mechanism', function () {
showdown.extensions.bazinga = extFunc;
var cnv = new showdown.Converter({extensions: ['bazinga']});
expect(cnv.getAllExtensions().language).to.eql([extObjMock]);
});
});