chore(doc-gen): add spaces when removing linebreaks for Jade _data.json files
Closes #3623 Closes #3997
This commit is contained in:
parent
34b91c62c5
commit
9d42b52d2c
|
@ -0,0 +1,8 @@
|
|||
var Package = require('dgeni').Package;
|
||||
|
||||
module.exports = function mockPackage() {
|
||||
|
||||
return new Package('mockPackage', [require('../')])
|
||||
|
||||
.factory('log', function() { return require('dgeni/lib/mocks/log')(false); })
|
||||
};
|
|
@ -44,7 +44,7 @@ module.exports = function addJadeDataDocsProcessor() {
|
|||
title: _.map(path.basename(doc.fileInfo.baseName).split('_'), function(part) {
|
||||
return titleCase(part);
|
||||
}).join(' '),
|
||||
intro: doc.description.replace('"', '\"').replace(/\r?\n|\r/g,"")
|
||||
intro: doc.description.replace('"', '\"').replace(/\s*(\r?\n|\r)\s*/g," ")
|
||||
}];
|
||||
|
||||
// GET DATA FOR EACH PAGE (CLASS, VARS, FUNCTIONS)
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
var mockPackage = require('../mocks/mockPackage');
|
||||
var Dgeni = require('dgeni');
|
||||
|
||||
describe('addJadeDataDocsProcessor', function() {
|
||||
var dgeni, injector, processor;
|
||||
|
||||
beforeEach(function() {
|
||||
dgeni = new Dgeni([mockPackage()]);
|
||||
injector = dgeni.configureInjector();
|
||||
processor = injector.get('addJadeDataDocsProcessor');
|
||||
});
|
||||
|
||||
it('should add a doc for each module', function() {
|
||||
var docs = [
|
||||
{
|
||||
docType: 'module',
|
||||
id: 'someModule',
|
||||
exports: [{ name: 'MyClass', docType: 'class'}],
|
||||
fileInfo: { baseName: 'x_y' },
|
||||
description: 'some description\nsecond line'
|
||||
}
|
||||
];
|
||||
docs = processor.$process(docs);
|
||||
|
||||
expect(docs[1]).toEqual({
|
||||
id : 'someModule-data',
|
||||
aliases : [ 'someModule-data' ],
|
||||
docType : 'jade-data',
|
||||
originalDoc : docs[0],
|
||||
data : [
|
||||
{ name : 'index', title : 'X Y', intro : 'some description second line' },
|
||||
{ name : 'MyClass-class', title : 'MyClass', varType : undefined }
|
||||
] });
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue