describe(`signatureTitle helper`, () => { test(`should compile`, () => { const data = project.findReflectionByName('functionWithParameters'); const result = Handlebars.helpers.signatureTitle.call(data.signatures[0]); expect(result).toMatchSnapshot(); }); });
export function ifBreadcrumbs(this: PageEvent, options) { if (MarkdownTheme.isSingleFile) { return options.inverse(this); } return MarkdownTheme.handlebars.helpers.ifBreadcrumbs.call(this, options); }
function renderPost (results) { const templateStr = fs.readFileSync(path.resolve(__dirname, 'release.hbs')).toString('utf8') const template = Handlebars.compile(templateStr, { noEscape: true }) const view = Object.assign({ date: new Date().toISOString(), versionSlug: slugify(results.version) }, results) return Object.assign({ content: template(view) }, results) }
export function relativeURL(url: string) { return MarkdownTheme.handlebars.helpers.relativeURL(url); }
describe(`utils helpers`, () => { test(`should compile headings helper`, () => { expect(Handlebars.helpers.heading.call(this, 2)).toEqual('##'); }); test(`should compile stripLineBreaks helper`, () => { const result = Handlebars.helpers.stripLineBreaks.call('line 1\n line2\n'); expect(result).toMatchSnapshot('line 1 line2'); }); test(`should compile spaces helper`, () => { const result = Handlebars.helpers.spaces.call(this, 3); expect(result).toEqual('!spaces '); }); });
describe(`literal helper`, () => { test(`should compile object literal`, () => { const data = project.findReflectionByName('objectLiteral'); const result = Handlebars.helpers.literal.call(data); expect(result).toMatchSnapshot(); }); test(`should compile type literal`, () => { const data = project.findReflectionByName('typeLiteral'); const result = Handlebars.helpers.literal.call(data); expect(result).toMatchSnapshot(); }); });
describe(`declarationTitle helper`, () => { test(`should compi;e`, () => { expect(Handlebars.helpers.declarationTitle.call(project.findReflectionByName('color'))).toMatchSnapshot(); }); });
describe(`typeAndParent helper`, () => { test(`should compile`, () => { const data = project.findReflectionByName('BaseClass'); const result = Handlebars.helpers.typeAndParent.call(data.children[3].implementationOf); expect(result).toMatchSnapshot(); }); });
export function breadcrumbs(this: PageEvent) { return MarkdownTheme.handlebars.helpers.breadcrumbs.call(this); }
describe(`parameterTable helper`, () => { test(`should compile`, () => { const data = project.findReflectionByName('functionWithDefaults'); const result = Handlebars.helpers.parameterTable.call(data.signatures[0].parameters); expect(result).toMatchSnapshot(); }); });
describe(`parameterNameAndType helper`, () => { test(`sould compile`, () => { const data = project.findReflectionByName('objectLiteral'); const result = Handlebars.helpers.parameterNameAndType.call(data); expect(result).toMatchSnapshot(); }); });
export function ifNamedAnchors(options) { return MarkdownTheme.handlebars.helpers.ifNamedAnchors.call(this, options); }