mirror of
https://github.com/showdownjs/showdown.git
synced 2024-03-22 13:30:55 +08:00
Merge branch 'master' into develop
This commit is contained in:
commit
f1eab2a7f2
|
@ -114,6 +114,7 @@ showdown.setFlavor = function (name) {
|
||||||
if (!flavor.hasOwnProperty(name)) {
|
if (!flavor.hasOwnProperty(name)) {
|
||||||
throw Error(name + ' flavor was not found');
|
throw Error(name + ' flavor was not found');
|
||||||
}
|
}
|
||||||
|
showdown.resetOptions();
|
||||||
var preset = flavor[name];
|
var preset = flavor[name];
|
||||||
setFlavor = name;
|
setFlavor = name;
|
||||||
for (var option in preset) {
|
for (var option in preset) {
|
||||||
|
|
|
@ -130,4 +130,29 @@ describe('showdown.setFlavor()', function () {
|
||||||
}
|
}
|
||||||
showdown.setFlavor('vanilla');
|
showdown.setFlavor('vanilla');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should switch between flavors correctly', function () {
|
||||||
|
showdown.setFlavor('github');
|
||||||
|
var ghOpts = showdown.getFlavorOptions('github'),
|
||||||
|
shOpts = showdown.getOptions(),
|
||||||
|
dfOpts = showdown.getDefaultOptions();
|
||||||
|
for (var opt in dfOpts) {
|
||||||
|
if (ghOpts.hasOwnProperty(opt)) {
|
||||||
|
shOpts[opt].should.equal(ghOpts[opt]);
|
||||||
|
} else {
|
||||||
|
shOpts[opt].should.equal(dfOpts[opt]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
showdown.setFlavor('original');
|
||||||
|
var orOpts = showdown.getFlavorOptions('original');
|
||||||
|
shOpts = showdown.getOptions();
|
||||||
|
for (opt in dfOpts) {
|
||||||
|
if (orOpts.hasOwnProperty(opt)) {
|
||||||
|
shOpts[opt].should.equal(orOpts[opt]);
|
||||||
|
} else {
|
||||||
|
shOpts[opt].should.equal(dfOpts[opt]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
showdown.setFlavor('vanilla');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user