feat(aio): first pass API docs redesign (#21874)
Includes: * display ToC for API docs * update dgeni-packages to 0.24.1 * add floating sidebar in API docs * add breadcrumbs and structured data for Google crawler * improved rendering of method overloads * properties rendered in a table * params rendered with docs * removal of outdated "infobox" from all API docs PR Close #21874
This commit is contained in:

committed by
Miško Hevery

parent
bc1e22922a
commit
7007f51c35
@ -0,0 +1,39 @@
|
||||
const testPackage = require('../../helpers/test-package');
|
||||
const processorFactory = require('./computeApiBreadCrumbs');
|
||||
const Dgeni = require('dgeni');
|
||||
|
||||
describe('angular-api-package: computeApiBreadCrumbs processor', () => {
|
||||
|
||||
it('should be available on the injector', () => {
|
||||
const dgeni = new Dgeni([testPackage('angular-api-package')]);
|
||||
const injector = dgeni.configureInjector();
|
||||
const processor = injector.get('computeApiBreadCrumbs');
|
||||
expect(processor.$process).toBeDefined();
|
||||
expect(processor.$runAfter).toEqual(['paths-computed']);
|
||||
expect(processor.$runBefore).toEqual(['rendering-docs']);
|
||||
});
|
||||
|
||||
it('should attach a breadCrumbs property to each of the EXPORT_DOC_TYPES docs', () => {
|
||||
const EXPORT_DOC_TYPES = ['class', 'interface'];
|
||||
const processor = processorFactory(EXPORT_DOC_TYPES);
|
||||
|
||||
const docs = [
|
||||
{ docType: 'class', name: 'ClassA', path: 'module-1/class-a', moduleDoc: { id: 'moduleOne', path: 'module-1' } },
|
||||
{ docType: 'interface', name: 'InterfaceB', path: 'module-2/interface-b', moduleDoc: { id: 'moduleTwo', path: 'module-2' } },
|
||||
{ docType: 'guide', name: 'Guide One', path: 'guide/guide-1' },
|
||||
];
|
||||
processor.$process(docs);
|
||||
|
||||
expect(docs[0].breadCrumbs).toEqual([
|
||||
{ text: 'API', path: '/api' },
|
||||
{ text: '@angular/moduleOne', path: 'module-1' },
|
||||
{ text: 'ClassA', path: 'module-1/class-a' },
|
||||
]);
|
||||
expect(docs[1].breadCrumbs).toEqual([
|
||||
{ text: 'API', path: '/api' },
|
||||
{ text: '@angular/moduleTwo', path: 'module-2' },
|
||||
{ text: 'InterfaceB', path: 'module-2/interface-b' },
|
||||
]);
|
||||
expect(docs[2].breadCrumbs).toBeUndefined();
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user