diff --git a/docs/angular.io-package/mocks/mockPackage.js b/docs/angular.io-package/mocks/mockPackage.js new file mode 100644 index 0000000000..473bc36adb --- /dev/null +++ b/docs/angular.io-package/mocks/mockPackage.js @@ -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); }) +}; diff --git a/docs/angular.io-package/processors/addJadeDataDocsProcessor.js b/docs/angular.io-package/processors/addJadeDataDocsProcessor.js index a6103cd1ab..9ae336c469 100644 --- a/docs/angular.io-package/processors/addJadeDataDocsProcessor.js +++ b/docs/angular.io-package/processors/addJadeDataDocsProcessor.js @@ -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) diff --git a/docs/angular.io-package/processors/addJadeDataDocsProcessor.spec.js b/docs/angular.io-package/processors/addJadeDataDocsProcessor.spec.js new file mode 100644 index 0000000000..e0e4c5965d --- /dev/null +++ b/docs/angular.io-package/processors/addJadeDataDocsProcessor.spec.js @@ -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 } + ] }); + }); +});