mirror of
https://github.com/showdownjs/showdown.git
synced 2024-03-22 13:30:55 +08:00
test(option.prefixHeaderId): add tests for prefixHeaderId option
This commit is contained in:
parent
6492e74c5b
commit
2a4a2bdf21
|
@ -45,6 +45,25 @@
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('Converter.options prefixHeaderId', function () {
|
||||||
|
var converter = new showdown.Converter(),
|
||||||
|
text = 'foo header';
|
||||||
|
|
||||||
|
it('should prefix header id with "section"', function () {
|
||||||
|
converter.setOption('prefixHeaderId', true);
|
||||||
|
var html = converter.makeHtml('# ' + text),
|
||||||
|
expectedHtml = '<h1 id="sectionfooheader">' + text + '</h1>';
|
||||||
|
html.should.equal(expectedHtml);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should prefix header id with custom string', function () {
|
||||||
|
converter.setOption('prefixHeaderId', 'blabla');
|
||||||
|
var html = converter.makeHtml('# ' + text),
|
||||||
|
expectedHtml = '<h1 id="blablafooheader">' + text + '</h1>';
|
||||||
|
html.should.equal(expectedHtml);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
function filter() {
|
function filter() {
|
||||||
return function (file) {
|
return function (file) {
|
||||||
var ext = file.slice(-3);
|
var ext = file.slice(-3);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user