From 2fb503dabfbbb74ae88f27428dc3b3af15349e6b Mon Sep 17 00:00:00 2001 From: Peter Bacon Darwin Date: Tue, 9 Aug 2016 17:38:25 +0100 Subject: [PATCH] doc-gen: fix filterable API list Closes #2054 --- tools/api-builder/angular.io-package/index.js | 2 +- .../processors/addJadeDataDocsProcessor.js | 17 +++++++++-- .../addJadeDataDocsProcessor.spec.js | 29 ++++++++++++------- 3 files changed, 34 insertions(+), 14 deletions(-) diff --git a/tools/api-builder/angular.io-package/index.js b/tools/api-builder/angular.io-package/index.js index 054d7837f7..493ea7f1be 100644 --- a/tools/api-builder/angular.io-package/index.js +++ b/tools/api-builder/angular.io-package/index.js @@ -138,7 +138,7 @@ module.exports = new Package('angular.io', [basePackage, targetPackage, cheatshe }); computePathsProcessor.pathTemplates.push({ - docTypes: ['api-list-data'], + docTypes: ['api-list-audit'], pathTemplate: 'api-list-audit.json', outputPathTemplate: '${path}' }); diff --git a/tools/api-builder/angular.io-package/processors/addJadeDataDocsProcessor.js b/tools/api-builder/angular.io-package/processors/addJadeDataDocsProcessor.js index b3fde862f5..a7caee0555 100644 --- a/tools/api-builder/angular.io-package/processors/addJadeDataDocsProcessor.js +++ b/tools/api-builder/angular.io-package/processors/addJadeDataDocsProcessor.js @@ -26,15 +26,26 @@ module.exports = function addJadeDataDocsProcessor() { $process: function(docs) { var extraDocs = []; var modules = []; + var data = {}; var appDataDoc = { id: 'api-list-data', aliases: ['api-list-data'], docType: 'api-list-data', - data: {} + data: data }; extraDocs.push(appDataDoc); + // create additional doc for auditing + var appDataAuditDoc = { + id: 'api-list-audit', + aliases: ['api-list-audit'], + docType: 'api-list-audit', + data: data + }; + extraDocs.push(appDataAuditDoc); + + /* * Create Data for Modules * @@ -76,7 +87,7 @@ module.exports = function addJadeDataDocsProcessor() { stability = 'deprecated'; exportDoc.showDeprecatedNotes = true; } - + var howToUse = ''; if(_.has(exportDoc, 'howToUse')) { var howToUseArray = exportDoc.tags.tags.filter(function(tag) { @@ -135,7 +146,7 @@ module.exports = function addJadeDataDocsProcessor() { doc.childPages = modulePageInfo; // ADD TO APP DATA DOC - appDataDoc.data[doc.id] = modulePageInfo; + data[doc.id] = modulePageInfo; // COMBINE WITH INDEX PAGE DATA var allPageData = indexPageInfo.concat(modulePageInfo); diff --git a/tools/api-builder/angular.io-package/processors/addJadeDataDocsProcessor.spec.js b/tools/api-builder/angular.io-package/processors/addJadeDataDocsProcessor.spec.js index 0423be79e1..e5f5daa60d 100644 --- a/tools/api-builder/angular.io-package/processors/addJadeDataDocsProcessor.spec.js +++ b/tools/api-builder/angular.io-package/processors/addJadeDataDocsProcessor.spec.js @@ -32,8 +32,18 @@ describe('addJadeDataDocsProcessor', function() { originalDoc : docs[0], data : [ { name : 'index', title : 'X Y', intro : 'some description second line', docType : 'module' }, - { name : 'someObj-var', title : 'someObj', varType : 'MyClass', docType: 'var', - originalModule: 'some/private/module', exportDoc: exportDoc } + { + name : 'someObj-var', + title : 'someObj', + varType : 'MyClass', + docType: 'var', + originalModule: 'some/private/module', + exportDoc: exportDoc, + stability : '', + howToUse : '', + whatItDoes : '', + security : false + } ] }); }); @@ -56,14 +66,13 @@ describe('addJadeDataDocsProcessor', function() { ]; docs = processor.$process(docs); - expect(docs[2].data).toEqual([ - { name : 'index', title : 'X Y', intro : 'some description second line', docType : 'module' }, - { name: 'Alpha-class', title: 'Alpha', docType: 'class', exportDoc: alpha }, - { name: 'Beta-class', title: 'Beta', docType: 'class', exportDoc: beta }, - { name: 'Gamma-class', title: 'Gamma', docType: 'class', exportDoc: gamma }, - { name: 'Mu-class', title: 'Mu', docType: 'class', exportDoc: mu }, - { name: 'Nu-class', title: 'Nu', docType: 'class', exportDoc: nu } - ]); + expect(docs[2].data).toEqual({ someModule : [ + { name: 'Alpha-class', title: 'Alpha', docType: 'class', exportDoc: alpha, stability : '', howToUse : '', whatItDoes : '', security : false }, + { name: 'Beta-class', title: 'Beta', docType: 'class', exportDoc: beta, stability : '', howToUse : '', whatItDoes : '', security : false }, + { name: 'Gamma-class', title: 'Gamma', docType: 'class', exportDoc: gamma, stability : '', howToUse : '', whatItDoes : '', security : false }, + { name: 'Mu-class', title: 'Mu', docType: 'class', exportDoc: mu, stability : '', howToUse : '', whatItDoes : '', security : false }, + { name: 'Nu-class', title: 'Nu', docType: 'class', exportDoc: nu, stability : '', howToUse : '', whatItDoes : '', security : false } + ]}); }); });