build(aio): fix various API rendering issues
Upgrading to dgeni-packages 0.21.4 gives us access to more properties on the API docs, which allows us to fix the following issues: Closes #19450 Closes #19452 Closes #19456
This commit is contained in:
parent
7cecaf2a4f
commit
9783c92935
|
@ -21,4 +21,24 @@ describe('Api pages', function() {
|
|||
const page = new ApiPage('api/animations/AnimationPlayer');
|
||||
expect(page.getDescendants('class')).toEqual(['NoopAnimationPlayer', 'MockAnimationPlayer'] as any);
|
||||
});
|
||||
|
||||
it('should show type params of type-aliases', () => {
|
||||
const page = new ApiPage('api/common/http/HttpEvent');
|
||||
expect(page.getOverview('type-alias').getText()).toContain('type HttpEvent<T>');
|
||||
});
|
||||
|
||||
it('should show readonly properties as getters', () => {
|
||||
const page = new ApiPage('api/common/http/HttpRequest');
|
||||
expect(page.getOverview('class').getText()).toContain('get body: T|null');
|
||||
});
|
||||
|
||||
it('should not show parenthesis for getters', () => {
|
||||
const page = new ApiPage('api/core/NgModuleRef');
|
||||
expect(page.getOverview('class').getText()).toContain('get injector: Injector');
|
||||
});
|
||||
|
||||
it('should show both type and initializer if set', () => {
|
||||
const page = new ApiPage('api/common/HashLocationStrategy');
|
||||
expect(page.getOverview('class').getText()).toContain('path(includeHash: boolean = false): string');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -27,4 +27,8 @@ export class ApiPage extends SitePage {
|
|||
const selector = `.descendants.${docType} ${onlyDirect ? '>' : ''} li > :not(ul) code`;
|
||||
return element.all(by.css(selector)).map<string>(item => item.getText());
|
||||
}
|
||||
|
||||
getOverview(docType) {
|
||||
return element(by.css(`.${docType}-overview`));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@
|
|||
"concurrently": "^3.4.0",
|
||||
"cross-spawn": "^5.1.0",
|
||||
"dgeni": "^0.4.7",
|
||||
"dgeni-packages": "^0.21.3",
|
||||
"dgeni-packages": "^0.21.4",
|
||||
"entities": "^1.1.1",
|
||||
"eslint": "^3.19.0",
|
||||
"eslint-plugin-jasmine": "^2.2.0",
|
||||
|
|
|
@ -18,10 +18,10 @@
|
|||
|
||||
{%- macro renderMember(member, truncateLines) -%}
|
||||
{%- if member.accessibility !== 'public' %}{$ member.accessibility $} {% endif -%}
|
||||
{%- if member.isGetAccessor %}get {% endif -%}
|
||||
{%- if member.isGetAccessor or member.isReadonly %}get {% endif -%}
|
||||
{%- if member.isSetAccessor %}set {% endif -%}
|
||||
{%- if member.isStatic %}static {% endif -%}
|
||||
{$ member.name $}{$ member.typeParameters | escape $}{$ params.paramList(member.parameters, truncateLines) | trim $}
|
||||
{$ member.name $}{$ member.typeParameters | escape $}{% if not member.isGetAccessor %}{$ params.paramList(member.parameters, truncateLines) | trim $}{% endif %}
|
||||
{%- if member.isOptional %}?{% endif -%}
|
||||
{$ params.returnType(member.type) | trim | truncateCode(truncateLines) $}
|
||||
{%- endmacro -%}
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
{% extends 'export-base.template.html' %}
|
||||
|
||||
{% block overview %}
|
||||
<code-example language="ts" hideCopy="true">
|
||||
type {$ doc.name $}{% if doc.typeDefinition %} = {$ doc.typeDefinition | escape $}{% endif %};
|
||||
</code-example>
|
||||
<section class="{$ doc.docType $}-overview">
|
||||
<code-example language="ts" hideCopy="true">
|
||||
type {$ doc.name $}{$ doc.typeParameters | escape $}{% if doc.typeDefinition %} = {$ doc.typeDefinition | escape $}{% endif %};
|
||||
</code-example>
|
||||
</section>
|
||||
{% endblock %}
|
||||
|
||||
{% block details %}
|
||||
|
|
|
@ -2003,8 +2003,8 @@ devtools-timeline-model@1.1.6:
|
|||
resolve "1.1.7"
|
||||
|
||||
dgeni-packages@^0.21.3:
|
||||
version "0.21.3"
|
||||
resolved "https://registry.yarnpkg.com/dgeni-packages/-/dgeni-packages-0.21.3.tgz#49d5264400cdd8c8a2f66040267e38c099d540f4"
|
||||
version "0.21.4"
|
||||
resolved "https://registry.yarnpkg.com/dgeni-packages/-/dgeni-packages-0.21.4.tgz#c77a0730b52ac5dbab00f10fae47dd148374aeb4"
|
||||
dependencies:
|
||||
canonical-path "0.0.2"
|
||||
catharsis "^0.8.1"
|
||||
|
|
Loading…
Reference in New Issue