Skip to content

Commit f1eab2a

Browse files
committed
Merge branch 'master' into develop
2 parents fa47938 + 3e22fc6 commit f1eab2a

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

src/showdown.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ showdown.setFlavor = function (name) {
114114
if (!flavor.hasOwnProperty(name)) {
115115
throw Error(name + ' flavor was not found');
116116
}
117+
showdown.resetOptions();
117118
var preset = flavor[name];
118119
setFlavor = name;
119120
for (var option in preset) {

test/node/showdown.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,4 +130,29 @@ describe('showdown.setFlavor()', function () {
130130
}
131131
showdown.setFlavor('vanilla');
132132
});
133+
134+
it('should switch between flavors correctly', function () {
135+
showdown.setFlavor('github');
136+
var ghOpts = showdown.getFlavorOptions('github'),
137+
shOpts = showdown.getOptions(),
138+
dfOpts = showdown.getDefaultOptions();
139+
for (var opt in dfOpts) {
140+
if (ghOpts.hasOwnProperty(opt)) {
141+
shOpts[opt].should.equal(ghOpts[opt]);
142+
} else {
143+
shOpts[opt].should.equal(dfOpts[opt]);
144+
}
145+
}
146+
showdown.setFlavor('original');
147+
var orOpts = showdown.getFlavorOptions('original');
148+
shOpts = showdown.getOptions();
149+
for (opt in dfOpts) {
150+
if (orOpts.hasOwnProperty(opt)) {
151+
shOpts[opt].should.equal(orOpts[opt]);
152+
} else {
153+
shOpts[opt].should.equal(dfOpts[opt]);
154+
}
155+
}
156+
showdown.setFlavor('vanilla');
157+
});
133158
});

0 commit comments

Comments
 (0)