diff --git a/aio/e2e/api.e2e-spec.ts b/aio/e2e/api.e2e-spec.ts index df588e9480..e31e7c8225 100644 --- a/aio/e2e/api.e2e-spec.ts +++ b/aio/e2e/api.e2e-spec.ts @@ -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'); + }); + + 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'); + }); }); diff --git a/aio/e2e/api.po.ts b/aio/e2e/api.po.ts index f6cd527244..dab4538b82 100644 --- a/aio/e2e/api.po.ts +++ b/aio/e2e/api.po.ts @@ -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(item => item.getText()); } + + getOverview(docType) { + return element(by.css(`.${docType}-overview`)); + } } diff --git a/aio/package.json b/aio/package.json index 8be3374faa..d975b5ae1e 100644 --- a/aio/package.json +++ b/aio/package.json @@ -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", diff --git a/aio/tools/transforms/templates/api/lib/memberHelpers.html b/aio/tools/transforms/templates/api/lib/memberHelpers.html index df61c59f63..2366c8c0b8 100644 --- a/aio/tools/transforms/templates/api/lib/memberHelpers.html +++ b/aio/tools/transforms/templates/api/lib/memberHelpers.html @@ -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 -%} diff --git a/aio/tools/transforms/templates/api/type-alias.template.html b/aio/tools/transforms/templates/api/type-alias.template.html index 330ec5d688..0f223318df 100644 --- a/aio/tools/transforms/templates/api/type-alias.template.html +++ b/aio/tools/transforms/templates/api/type-alias.template.html @@ -1,9 +1,11 @@ {% extends 'export-base.template.html' %} {% block overview %} - - type {$ doc.name $}{% if doc.typeDefinition %} = {$ doc.typeDefinition | escape $}{% endif %}; - +
+ + type {$ doc.name $}{$ doc.typeParameters | escape $}{% if doc.typeDefinition %} = {$ doc.typeDefinition | escape $}{% endif %}; + +
{% endblock %} {% block details %} diff --git a/aio/yarn.lock b/aio/yarn.lock index 614cbe3dfd..e84b2f624b 100644 --- a/aio/yarn.lock +++ b/aio/yarn.lock @@ -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"