Skip to content

Commit

Permalink
Use raw description when building properties (Fixes esdoc#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
existentialism committed Oct 27, 2015
1 parent f2b0b66 commit 7e87ea7
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/Publisher/Builder/DocBuilder.js
Expand Up @@ -898,7 +898,7 @@ export default class DocBuilder {
ice.attr('property', 'data-depth', prop.name.split('.').length - 1);
ice.text('name', prop.name);
ice.attr('name', 'data-depth', prop.name.split('.').length - 1);
ice.load('description', prop.description);
ice.load('description', prop.descriptionRaw);

let typeNames = [];
for (var typeName of prop.types) {
Expand Down
4 changes: 4 additions & 0 deletions test/fixture/src/myFunction.js
Expand Up @@ -63,6 +63,10 @@ export function myFunction8(p1) {
export function myFunction9(p1 = {}) {
}

/** @param {string} x The only parameter of {@link myFunction99}. */
export function myFunction99(x) {
}

/**
* this is myFunctionSeparateExport1.
* @param {number} p1 - this is p1.
Expand Down
10 changes: 5 additions & 5 deletions test/src/BuilderTest/CoverageDocTest.js
Expand Up @@ -8,9 +8,9 @@ describe('Coverage:', ()=> {
it('has coverage.json', ()=>{
let json = fs.readFileSync('./test/fixture/esdoc/coverage.json', {encoding: 'utf8'}).toString();
let coverage = JSON.parse(json);
assert.equal(coverage.coverage, '89.72%');
assert.equal(coverage.expectCount, 146);
assert.equal(coverage.actualCount, 131);
assert.equal(coverage.coverage, '89.79%');
assert.equal(coverage.expectCount, 147);
assert.equal(coverage.actualCount, 132);
assert.deepEqual(coverage.files, {
"src/ForTestDoc/AbstractDoc.js": {
"expectCount": 3,
Expand Down Expand Up @@ -108,8 +108,8 @@ describe('Coverage:', ()=> {
"undocumentLines": []
},
"src/myFunction.js": {
"expectCount": 11,
"actualCount": 9,
"expectCount": 12,
"actualCount": 10,
"undocumentLines": [
50,
55
Expand Down
10 changes: 7 additions & 3 deletions test/src/BuilderTest/FunctionDocTest.js
Expand Up @@ -16,8 +16,8 @@ describe('MyFunction:', ()=>{
assert.includes(doc, '[data-ice="target"]:nth-of-type(7)', 'public myFunction7(p1: *[], p2: number[], p3: {}, p4: {"a": number, "b": string}): *');
assert.includes(doc, '[data-ice="target"]:nth-of-type(8)', 'public myFunction8(p1: *)');
assert.includes(doc, '[data-ice="target"]:nth-of-type(9)', 'public myFunction9(p1: Object): Object this is myFunction9 desc.');
assert.includes(doc, '[data-ice="target"]:nth-of-type(10)', 'public myFunctionSeparateExport1(p1: number) this is myFunctionSeparateExport1.');
assert.includes(doc, '[data-ice="target"]:nth-of-type(11)', 'public myFunctionSeparateExport2(p1: number) this is myFunctionSeparateExport2.');
assert.includes(doc, '[data-ice="target"]:nth-of-type(11)', 'public myFunctionSeparateExport1(p1: number) this is myFunctionSeparateExport1.');
assert.includes(doc, '[data-ice="target"]:nth-of-type(12)', 'public myFunctionSeparateExport2(p1: number) this is myFunctionSeparateExport2.');

assert.includes(doc, '[data-ice="target"]:nth-of-type(1) [data-ice="name"] a', 'function/index.html#static-function-myFunction1', 'href');
});
Expand Down Expand Up @@ -72,11 +72,15 @@ describe('MyFunction:', ()=>{
});

find(doc, '[data-ice="detail"]:nth-of-type(10)', (doc)=>{
assert.includes(doc, '[data-ice="description"] a', 'function/index.html#static-function-myFunction99', 'href');
});

find(doc, '[data-ice="detail"]:nth-of-type(11)', (doc)=>{
assert.includes(doc, '#static-function-myFunctionSeparateExport1', 'public myFunctionSeparateExport1(p1: number)');
assert.includes(doc, '[data-ice="importPath"]', "import myFunctionSeparateExport1 from 'esdoc-test-fixture/src/myFunction.js'");
});

find(doc, '[data-ice="detail"]:nth-of-type(11)', (doc)=>{
find(doc, '[data-ice="detail"]:nth-of-type(12)', (doc)=>{
assert.includes(doc, '#static-function-myFunctionSeparateExport2', 'public myFunctionSeparateExport2(p1: number)');
assert.includes(doc, '[data-ice="importPath"]', "import {myFunctionSeparateExport2} from 'esdoc-test-fixture/src/myFunction.js'");
});
Expand Down
14 changes: 7 additions & 7 deletions test/src/BuilderTest/NavDocTest.js
Expand Up @@ -20,17 +20,17 @@ describe('Nav:', ()=> {
assert.includes(doc, '[data-ice="doc"]:nth-of-type(31) a', 'function/index.html#static-function-myFunction1', 'href');

// variable
assert.includes(doc, '[data-ice="doc"]:nth-of-type(43)', 'myExport1');
assert.includes(doc, '[data-ice="doc"]:nth-of-type(51)', 'myVariable1');
assert.includes(doc, '[data-ice="doc"]:nth-of-type(51) a', 'variable/index.html#static-variable-myVariable1', 'href');
assert.includes(doc, '[data-ice="doc"]:nth-of-type(44)', 'myExport1');
assert.includes(doc, '[data-ice="doc"]:nth-of-type(52)', 'myVariable1');
assert.includes(doc, '[data-ice="doc"]:nth-of-type(52) a', 'variable/index.html#static-variable-myVariable1', 'href');

// typedef
assert.includes(doc, '[data-ice="doc"]:nth-of-type(59)', 'MyTypedef1');
assert.includes(doc, '[data-ice="doc"]:nth-of-type(59) a', 'typedef/index.html#static-typedef-MyTypedef1', 'href');
assert.includes(doc, '[data-ice="doc"]:nth-of-type(60)', 'MyTypedef1');
assert.includes(doc, '[data-ice="doc"]:nth-of-type(60) a', 'typedef/index.html#static-typedef-MyTypedef1', 'href');

// external
assert.includes(doc, '[data-ice="doc"]:nth-of-type(61)', 'MyError2');
assert.includes(doc, '[data-ice="doc"]:nth-of-type(61) a', 'example.com', 'href');
assert.includes(doc, '[data-ice="doc"]:nth-of-type(62)', 'MyError2');
assert.includes(doc, '[data-ice="doc"]:nth-of-type(62) a', 'example.com', 'href');
});
});
});
2 changes: 1 addition & 1 deletion test/src/BuilderTest/nAnonymousTest.js
Expand Up @@ -19,7 +19,7 @@ describe('Anonymous', ()=>{
let doc = readDoc('function/index.html');

it('has anonymous function', ()=>{
assert.includes(doc, '[data-ice="summary"] [data-ice="target"]:nth-of-type(12)', 'nMyAnonymous1');
assert.includes(doc, '[data-ice="summary"] [data-ice="target"]:nth-of-type(13)', 'nMyAnonymous1');
});
});
});

0 comments on commit 7e87ea7

Please sign in to comment.