node-query/node_modules/jsdoc/plugins/test/specs/markdown.js

50 lines
1.8 KiB
JavaScript
Raw Normal View History

2015-01-28 15:33:44 -05:00
'use strict';
2014-10-22 10:11:40 -04:00
var path = require('jsdoc/path');
2015-01-28 15:33:44 -05:00
describe('markdown plugin', function() {
2014-10-22 10:11:40 -04:00
var pluginPath = 'plugins/markdown';
2015-01-28 15:33:44 -05:00
var pluginPathResolved = path.join(global.env.dirname, pluginPath);
2014-10-22 10:11:40 -04:00
var plugin = require(pluginPathResolved);
2015-01-28 15:33:44 -05:00
var docSet = jasmine.getDocSetFromFile('plugins/test/fixtures/markdown.js');
// TODO: more tests; refactor the plugin so multiple settings can be tested
2014-10-20 16:56:45 -04:00
2015-01-28 15:33:44 -05:00
it('should process the correct tags by default', function() {
var myClass = docSet.getByLongname('MyClass')[0];
plugin.handlers.newDoclet({ doclet: myClass });
[
myClass.author[0],
myClass.classdesc,
myClass.description,
myClass.exceptions[0].description,
myClass.params[0].description,
myClass.properties[0].description,
myClass.returns[0].description,
myClass.see
].forEach(function(value) {
// if we processed the value, it should be wrapped in a <p> tag
expect( /^<p>(?:.+)<\/p>$/.test(value) ).toBe(true);
});
2014-10-22 10:11:40 -04:00
});
2014-10-20 16:56:45 -04:00
2015-01-28 15:33:44 -05:00
describe('@see tag support', function() {
var foo = docSet.getByLongname('foo')[0];
var bar = docSet.getByLongname('bar')[0];
it('should parse @see tags containing links', function() {
plugin.handlers.newDoclet({ doclet: foo });
expect(typeof foo).toEqual('object');
expect(foo.see[0]).toEqual('<p><a href="http://nowhere.com">Nowhere</a></p>');
});
it('should not parse @see tags that do not contain links', function() {
plugin.handlers.newDoclet({ doclet: bar });
expect(typeof bar).toEqual('object');
expect(bar.see[0]).toEqual('AnObject#myProperty');
});
2014-10-22 10:11:40 -04:00
});
});