Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
tivie committed Mar 30, 2017
2 parents fa47938 + 3e22fc6 commit f1eab2a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/showdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ showdown.setFlavor = function (name) {
if (!flavor.hasOwnProperty(name)) {
throw Error(name + ' flavor was not found');
}
showdown.resetOptions();
var preset = flavor[name];
setFlavor = name;
for (var option in preset) {
Expand Down
25 changes: 25 additions & 0 deletions test/node/showdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,29 @@ describe('showdown.setFlavor()', function () {
}
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');
});
});

0 comments on commit f1eab2a

Please sign in to comment.