Skip to content

Commit de7d032

Browse files
authoredFeb 7, 2020
fix: cdk test harness API document not found (#716)
The CDK test harness documentation API has `test-harnesses` as id. This doesn't match any generated API document since the API doc for `@angular/cdk/testing` is generated with the `cdk-testing` id. We should add support for custom API doc ids that differ from the actual doc entry id in order to fix this issue.
1 parent 594cfe6 commit de7d032

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed
 

‎material.angular.io/src/app/pages/component-viewer/component-api.html

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
API for {{docItem?.id}}
44
</span>
55

6-
<doc-viewer
7-
documentUrl="/docs-content/api-docs/{{docItem?.packageName}}-{{docItem?.id}}.html"
6+
<doc-viewer [documentUrl]="getApiDocumentUrl(docItem!)"
87
class="docs-component-view-text-content docs-component-api"
98
(contentRendered)="updateTableOfContents(docItem!.name, $event)">
109
</doc-viewer>

‎material.angular.io/src/app/pages/component-viewer/component-viewer.ts

+5
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,11 @@ export class ComponentApi extends ComponentBaseView {
128128
constructor(componentViewer: ComponentViewer, breakpointObserver: BreakpointObserver) {
129129
super(componentViewer, breakpointObserver);
130130
}
131+
132+
getApiDocumentUrl(doc: DocItem) {
133+
const apiDocId = doc.apiDocId || `${doc.packageName}-${doc.id}`;
134+
return `/docs-content/api-docs/${apiDocId}.html`;
135+
}
131136
}
132137

133138
@Component({

‎material.angular.io/src/app/shared/documentation-items/documentation-items.ts

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export interface DocItem {
1111
summary?: string;
1212
packageName?: string;
1313
examples?: string[];
14+
apiDocId?: string;
1415
additionalApiDocs?: AdditionalApiDoc[];
1516
}
1617

@@ -563,6 +564,7 @@ const DOCS: {[key: string]: DocCategory[]} = {
563564
name: 'Component Harnesses',
564565
summary: 'Foundation for component test harnesses.',
565566
examples: [],
567+
apiDocId: 'cdk-testing',
566568
additionalApiDocs: [
567569
{
568570
name: 'Testbed',

0 commit comments

Comments
 (0)
Please sign in to comment.