jsdoc/plugins/test/specs/escapeHtml.js
Jeff Williams 85cbed9c0c change loading process for plugins and Markdown highlighters; remove jsdoc/path
We now simply use `require()` to load plugins and Markdown highlighters.

Note that `@jsdoc/util.path.commonPrefix`, unlike `jsdoc/path.commonPrefix`, does not append `path.sep` to the return value.

Includes other minor cleanup.
2019-01-27 15:18:28 -08:00

20 lines
765 B
JavaScript

/* global jsdoc */
describe('escapeHtml plugin', () => {
const env = require('jsdoc/env');
const path = require('path');
let docSet;
const parser = jsdoc.createParser();
const pluginPath = 'plugins/escapeHtml';
const pluginPathResolved = path.join(env.dirname, pluginPath);
require('jsdoc/plugins').installPlugins([pluginPathResolved], parser);
docSet = jsdoc.getDocSetFromFile(`${pluginPath}.js`, parser);
it("should escape '&', '<' and newlines in doclet descriptions", () => {
const doclet = docSet.getByLongname('module:plugins/escapeHtml.handlers.newDoclet');
expect(doclet[0].description).toEqual('Translate HTML tags in descriptions into safe entities. Replaces &lt;, &amp; and newlines');
});
});