docs: migrate examples from @angular/http to @angular/common/http (#28296)

PR Close #28296
This commit is contained in:
Adam Plumer
2018-11-09 20:23:46 -06:00
committed by Kara Erickson
parent 4b9eb6185f
commit a29ce57732
38 changed files with 2432 additions and 2758 deletions

View File

@ -17,17 +17,10 @@ describe('angular-api-package: computeApiBreadCrumbs processor', () => {
const API_DOC_TYPES_TO_RENDER = ['class', 'interface', 'package'];
const processor = processorFactory(API_DOC_TYPES_TO_RENDER);
const httpPackage = { docType: 'package', name: '@angular/http', id: 'http', path: 'http', isPrimaryPackage: true };
const httpTestingPackage = { docType: 'package', name: '@angular/http/testing', id: 'http/testing', path: 'http/testing', packageInfo: { primary: httpPackage } };
const testRequestClass = { docType: 'class', name: 'TestRequest', path: 'http/testing/test-request', moduleDoc: httpTestingPackage };
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' },
httpPackage,
httpTestingPackage,
testRequestClass
];
processor.$process(docs);
@ -42,20 +35,5 @@ describe('angular-api-package: computeApiBreadCrumbs processor', () => {
{ text: 'InterfaceB', path: 'module-2/interface-b' },
]);
expect(docs[2].breadCrumbs).toBeUndefined();
expect(docs[3].breadCrumbs).toEqual([
{ text: 'API', path: '/api' },
{ text: '@angular/http', path: 'http' },
]);
expect(docs[4].breadCrumbs).toEqual([
{ text: 'API', path: '/api' },
{ text: '@angular/http', path: 'http' },
{ text: '@angular/http/testing', path: 'http/testing' },
]);
expect(docs[5].breadCrumbs).toEqual([
{ text: 'API', path: '/api' },
{ text: '@angular/http', path: 'http' },
{ text: '@angular/http/testing', path: 'http/testing' },
{ text: 'TestRequest', path: 'http/testing/test-request' },
]);
});
});

View File

@ -40,13 +40,11 @@ describe('generateApiListDoc processor', () => {
const docs = [
{ docType: 'package', id: '@angular/common/index', exports: [], path: 'common' },
{ docType: 'package', id: '@angular/core/index', exports: [], path: 'core' },
{ docType: 'package', id: '@angular/http/index', exports: [], path: 'http' },
];
processor.$process(docs);
expect(docs[3].data).toEqual([
expect(docs[2].data).toEqual([
{ name: '@angular/common', title: '@angular/common', items: [], path: 'common' },
{ name: '@angular/core', title: '@angular/core', items: [], path: 'core' },
{ name: '@angular/http', title: '@angular/http', items: [], path: 'http' },
]);
});