build(aio): sort API list alphabetically (#19566)
Closes #19559 PR Close #19566
This commit is contained in:
parent
f393d86c96
commit
963a4d0dc8
|
@ -26,7 +26,9 @@ function getModuleInfo(moduleDoc) {
|
|||
title: moduleName,
|
||||
items: moduleDoc.exports
|
||||
// Ignore internals and private exports (indicated by the ɵ prefix)
|
||||
.filter(doc => !doc.internal && !doc.privateExport).map(getExportInfo)
|
||||
.filter(doc => !doc.internal && !doc.privateExport)
|
||||
.map(getExportInfo)
|
||||
.sort((a, b) => a.name === b.name ? 0 : a.name > b.name ? 1 : -1)
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -113,7 +113,6 @@ describe('generateApiListDoc processor', () => {
|
|||
]);
|
||||
});
|
||||
|
||||
|
||||
it('should convert security to a boolean securityRisk', () => {
|
||||
const processor = processorFactory();
|
||||
const docs = [
|
||||
|
@ -129,7 +128,6 @@ describe('generateApiListDoc processor', () => {
|
|||
]);
|
||||
});
|
||||
|
||||
|
||||
it('should convert stability tags to the stable string property', () => {
|
||||
const processor = processorFactory();
|
||||
const docs = [
|
||||
|
@ -148,5 +146,24 @@ describe('generateApiListDoc processor', () => {
|
|||
{ docType: 'class', title: 'DddDdd', name: 'dddddd', path: 'ddd', stability: '', securityRisk: false },
|
||||
]);
|
||||
});
|
||||
|
||||
it('should sort items in each group alphabetically', () => {
|
||||
const processor = processorFactory();
|
||||
const docs = [
|
||||
{ docType: 'module', id: '@angular/common/index', exports: [
|
||||
{ docType: 'class', name: 'DddDdd', path: 'uuu' },
|
||||
{ docType: 'class', name: 'BbbBbb', path: 'vvv' },
|
||||
{ docType: 'class', name: 'AaaAaa', path: 'xxx' },
|
||||
{ docType: 'class', name: 'CccCcc', path: 'yyy' },
|
||||
]}
|
||||
];
|
||||
processor.$process(docs);
|
||||
expect(docs[1].data[0].items).toEqual([
|
||||
{ docType: 'class', title: 'AaaAaa', name: 'aaaaaa', path: 'xxx', stability: '', securityRisk: false },
|
||||
{ docType: 'class', title: 'BbbBbb', name: 'bbbbbb', path: 'vvv', stability: '', securityRisk: false },
|
||||
{ docType: 'class', title: 'CccCcc', name: 'cccccc', path: 'yyy', stability: '', securityRisk: false },
|
||||
{ docType: 'class', title: 'DddDdd', name: 'dddddd', path: 'uuu', stability: '', securityRisk: false },
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue