build(aio): sort API list alphabetically (#19566)
Closes #19559 PR Close #19566
This commit is contained in:
parent
3d9c2a6352
commit
34f70c6de2
@ -26,7 +26,9 @@ function getModuleInfo(moduleDoc) {
|
|||||||
title: moduleName,
|
title: moduleName,
|
||||||
items: moduleDoc.exports
|
items: moduleDoc.exports
|
||||||
// Ignore internals and private exports (indicated by the ɵ prefix)
|
// 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', () => {
|
it('should convert security to a boolean securityRisk', () => {
|
||||||
const processor = processorFactory();
|
const processor = processorFactory();
|
||||||
const docs = [
|
const docs = [
|
||||||
@ -129,7 +128,6 @@ describe('generateApiListDoc processor', () => {
|
|||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
it('should convert stability tags to the stable string property', () => {
|
it('should convert stability tags to the stable string property', () => {
|
||||||
const processor = processorFactory();
|
const processor = processorFactory();
|
||||||
const docs = [
|
const docs = [
|
||||||
@ -148,5 +146,24 @@ describe('generateApiListDoc processor', () => {
|
|||||||
{ docType: 'class', title: 'DddDdd', name: 'dddddd', path: 'ddd', stability: '', securityRisk: false },
|
{ 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…
x
Reference in New Issue
Block a user