1 | 'use strict';
|
2 |
|
3 | var env = require('jsdoc/env');
|
4 | var path = require('jsdoc/path');
|
5 |
|
6 | describe('markdown plugin', function() {
|
7 | var pluginPath = 'plugins/markdown';
|
8 | var pluginPathResolved = path.join(env.dirname, pluginPath);
|
9 | var plugin = require(pluginPathResolved);
|
10 |
|
11 | var docSet = jasmine.getDocSetFromFile('plugins/test/fixtures/markdown.js');
|
12 |
|
13 |
|
14 |
|
15 | it('should process the correct tags by default', function() {
|
16 | var myClass = docSet.getByLongname('MyClass')[0];
|
17 |
|
18 | plugin.handlers.newDoclet({ doclet: myClass });
|
19 | [
|
20 | myClass.author[0],
|
21 | myClass.classdesc,
|
22 | myClass.description,
|
23 | myClass.exceptions[0].description,
|
24 | myClass.params[0].description,
|
25 | myClass.properties[0].description,
|
26 | myClass.returns[0].description,
|
27 | myClass.see,
|
28 | myClass.summary
|
29 | ].forEach(function(value) {
|
30 |
|
31 | expect( /^<p>(?:.+)<\/p>$/.test(value) ).toBe(true);
|
32 | });
|
33 | });
|
34 |
|
35 | it('should unescape " entities in inline tags, but not elsewhere', function() {
|
36 | var myOtherClass = docSet.getByLongname('MyOtherClass')[0];
|
37 |
|
38 | plugin.handlers.newDoclet({ doclet: myOtherClass });
|
39 |
|
40 | expect(myOtherClass.description).toContain('chat."#channel"."say-\\"hello\\""');
|
41 | expect(myOtherClass.description).toContain('"See"');
|
42 | });
|
43 |
|
44 | describe('@see tag support', function() {
|
45 | var foo = docSet.getByLongname('foo')[0];
|
46 | var bar = docSet.getByLongname('bar')[0];
|
47 |
|
48 | it('should parse @see tags containing links', function() {
|
49 | plugin.handlers.newDoclet({ doclet: foo });
|
50 | expect(typeof foo).toEqual('object');
|
51 | expect(foo.see[0]).toEqual('<p><a href="http://nowhere.com">Nowhere</a></p>');
|
52 | });
|
53 |
|
54 | it('should not parse @see tags that do not contain links', function() {
|
55 | plugin.handlers.newDoclet({ doclet: bar });
|
56 | expect(typeof bar).toEqual('object');
|
57 | expect(bar.see[0]).toEqual('AnObject#myProperty');
|
58 | });
|
59 | });
|
60 | });
|