chore(doc-gen/angular.io): sort exports alphabetically
This commit is contained in:
parent
457b689bf0
commit
608f35b4a7
|
@ -48,13 +48,18 @@ module.exports = function addJadeDataDocsProcessor() {
|
||||||
}];
|
}];
|
||||||
|
|
||||||
// GET DATA FOR EACH PAGE (CLASS, VARS, FUNCTIONS)
|
// GET DATA FOR EACH PAGE (CLASS, VARS, FUNCTIONS)
|
||||||
var modulePageInfo = _.map(doc.exports, function(exportDoc) {
|
var modulePageInfo = _(doc.exports)
|
||||||
|
.map(function(exportDoc) {
|
||||||
return {
|
return {
|
||||||
name: exportDoc.name + '-' + exportDoc.docType,
|
name: exportDoc.name + '-' + exportDoc.docType,
|
||||||
title: exportDoc.name,
|
title: exportDoc.name,
|
||||||
varType: exportDoc.symbolTypeName && titleCase(exportDoc.symbolTypeName)
|
varType: exportDoc.symbolTypeName && titleCase(exportDoc.symbolTypeName)
|
||||||
};
|
};
|
||||||
});
|
})
|
||||||
|
.sortBy('name')
|
||||||
|
.value();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//COMBINE PAGE DATA
|
//COMBINE PAGE DATA
|
||||||
var allPageData = indexPageInfo.concat(modulePageInfo);
|
var allPageData = indexPageInfo.concat(modulePageInfo);
|
||||||
|
|
|
@ -32,4 +32,33 @@ describe('addJadeDataDocsProcessor', function() {
|
||||||
{ name : 'MyClass-class', title : 'MyClass', varType : undefined }
|
{ name : 'MyClass-class', title : 'MyClass', varType : undefined }
|
||||||
] });
|
] });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should sort the exports into alphabetical order', function() {
|
||||||
|
var docs = [
|
||||||
|
{
|
||||||
|
docType: 'module',
|
||||||
|
id: 'someModule',
|
||||||
|
exports: [
|
||||||
|
{ name: 'Beta', docType: 'class'},
|
||||||
|
{ name: 'Alpha', docType: 'class'},
|
||||||
|
{ name: 'Gamma', docType: 'class'},
|
||||||
|
{ name: 'Nu', docType: 'class'},
|
||||||
|
{ name: 'Mu', docType: 'class'}
|
||||||
|
],
|
||||||
|
fileInfo: { baseName: 'x_y' },
|
||||||
|
description: 'some description\nsecond line'
|
||||||
|
}
|
||||||
|
];
|
||||||
|
docs = processor.$process(docs);
|
||||||
|
|
||||||
|
expect(docs[1].data).toEqual([
|
||||||
|
{ name : 'index', title : 'X Y', intro : 'some description second line' },
|
||||||
|
{ name: 'Alpha-class', title: 'Alpha', varType : undefined },
|
||||||
|
{ name: 'Beta-class', title: 'Beta', varType : undefined },
|
||||||
|
{ name: 'Gamma-class', title: 'Gamma', varType : undefined },
|
||||||
|
{ name: 'Mu-class', title: 'Mu', varType : undefined },
|
||||||
|
{ name: 'Nu-class', title: 'Nu', varType : undefined }
|
||||||
|
]);
|
||||||
|
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue