mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-05 21:02:43 +00:00
Update tests and custom link renderer
v15 changes where html gets escaped and escapes plain text more consistently. Needed to update tests to match.
This commit is contained in:
8
package-lock.json
generated
8
package-lock.json
generated
@@ -33,7 +33,7 @@
|
|||||||
"jwt-simple": "^0.5.6",
|
"jwt-simple": "^0.5.6",
|
||||||
"less": "^3.13.1",
|
"less": "^3.13.1",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"marked": "14.1.4",
|
"marked": "15.0.0",
|
||||||
"marked-emoji": "^2.0.0",
|
"marked-emoji": "^2.0.0",
|
||||||
"marked-extended-tables": "^2.0.1",
|
"marked-extended-tables": "^2.0.1",
|
||||||
"marked-gfm-heading-id": "^4.0.1",
|
"marked-gfm-heading-id": "^4.0.1",
|
||||||
@@ -9892,9 +9892,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/marked": {
|
"node_modules/marked": {
|
||||||
"version": "14.1.4",
|
"version": "15.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/marked/-/marked-14.1.4.tgz",
|
"resolved": "https://registry.npmjs.org/marked/-/marked-15.0.0.tgz",
|
||||||
"integrity": "sha512-vkVZ8ONmUdPnjCKc5uTRvmkRbx4EAi2OkTOXmfTDhZz3OFqMNBM1oTTWwTr4HY4uAEojhzPf+Fy8F1DWa3Sndg==",
|
"integrity": "sha512-0mouKmBROJv/WSHJBPZZyYofUgawMChnD5je/g+aOBXsHDjb/IsnTQj7mnhQZu+qPJmRQ0ecX3mLGEUm3BgwYA==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"bin": {
|
"bin": {
|
||||||
"marked": "bin/marked.js"
|
"marked": "bin/marked.js"
|
||||||
|
|||||||
@@ -107,7 +107,7 @@
|
|||||||
"jwt-simple": "^0.5.6",
|
"jwt-simple": "^0.5.6",
|
||||||
"less": "^3.13.1",
|
"less": "^3.13.1",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"marked": "14.1.4",
|
"marked": "15.0.0",
|
||||||
"marked-emoji": "^2.0.0",
|
"marked-emoji": "^2.0.0",
|
||||||
"marked-extended-tables": "^2.0.1",
|
"marked-extended-tables": "^2.0.1",
|
||||||
"marked-gfm-heading-id": "^4.0.1",
|
"marked-gfm-heading-id": "^4.0.1",
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ renderer.link = function (token) {
|
|||||||
}
|
}
|
||||||
let out = `<a href="${escape(href)}"`;
|
let out = `<a href="${escape(href)}"`;
|
||||||
if(title) {
|
if(title) {
|
||||||
out += ` title="${title}"`;
|
out += ` title="${escape(title)}"`;
|
||||||
}
|
}
|
||||||
if(self) {
|
if(self) {
|
||||||
out += ' target="_self"';
|
out += ' target="_self"';
|
||||||
|
|||||||
@@ -54,19 +54,19 @@ describe('Non-Breaking Spaces', ()=>{
|
|||||||
test('I am actually a single-line definition list!', function() {
|
test('I am actually a single-line definition list!', function() {
|
||||||
const source = 'Term ::> Definition 1\n';
|
const source = 'Term ::> Definition 1\n';
|
||||||
const rendered = Markdown.render(source).trim();
|
const rendered = Markdown.render(source).trim();
|
||||||
expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`<dl><dt>Term</dt><dd>> Definition 1</dd>\n</dl>`);
|
expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`<dl><dt>Term</dt><dd>> Definition 1</dd>\n</dl>`);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('I am actually a definition list!', function() {
|
test('I am actually a definition list!', function() {
|
||||||
const source = 'Term\n::> Definition 1\n';
|
const source = 'Term\n::> Definition 1\n';
|
||||||
const rendered = Markdown.render(source).trim();
|
const rendered = Markdown.render(source).trim();
|
||||||
expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`<dl><dt>Term</dt>\n<dd>> Definition 1</dd></dl>`);
|
expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`<dl><dt>Term</dt>\n<dd>> Definition 1</dd></dl>`);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('I am actually a two-term definition list!', function() {
|
test('I am actually a two-term definition list!', function() {
|
||||||
const source = 'Term\n::> Definition 1\n::>> Definition 2';
|
const source = 'Term\n::> Definition 1\n::>> Definition 2';
|
||||||
const rendered = Markdown.render(source).trim();
|
const rendered = Markdown.render(source).trim();
|
||||||
expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`<dl><dt>Term</dt>\n<dd>> Definition 1</dd>\n<dd>>> Definition 2</dd></dl>`);
|
expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`<dl><dt>Term</dt>\n<dd>> Definition 1</dd>\n<dd>>> Definition 2</dd></dl>`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user