From adbb920ae8f43bbd1afcc41f3efda591ba0bf13f Mon Sep 17 00:00:00 2001 From: Pete Bacon Darwin Date: Wed, 26 Sep 2018 13:39:51 +0100 Subject: [PATCH] build(docs-infra): simplify property syntax rendering (#25768) PR Close #25768 --- aio/src/styles/2-modules/_api-pages.scss | 2 +- aio/tests/e2e/api.e2e-spec.ts | 7 +------ aio/tools/transforms/templates/api/lib/memberHelpers.html | 3 +-- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/aio/src/styles/2-modules/_api-pages.scss b/aio/src/styles/2-modules/_api-pages.scss index e4d649f00e..bed79e1dcf 100644 --- a/aio/src/styles/2-modules/_api-pages.scss +++ b/aio/src/styles/2-modules/_api-pages.scss @@ -96,7 +96,7 @@ } } - .from-constructor, .read-only-property { + .from-constructor, .read-only-property, .write-only-property { font-style: italic; color: $blue; } diff --git a/aio/tests/e2e/api.e2e-spec.ts b/aio/tests/e2e/api.e2e-spec.ts index c556ed11e7..b97e89e4f3 100644 --- a/aio/tests/e2e/api.e2e-spec.ts +++ b/aio/tests/e2e/api.e2e-spec.ts @@ -38,14 +38,9 @@ describe('Api pages', function() { 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'); + expect(page.getOverview('class').getText()).toContain('injector: Injector'); }); it('should show both type and initializer if set', () => { diff --git a/aio/tools/transforms/templates/api/lib/memberHelpers.html b/aio/tools/transforms/templates/api/lib/memberHelpers.html index 798675dbaa..476a77149a 100644 --- a/aio/tools/transforms/templates/api/lib/memberHelpers.html +++ b/aio/tools/transforms/templates/api/lib/memberHelpers.html @@ -34,8 +34,6 @@ {%- if member.accessibility !== 'public' %}{$ member.accessibility $} {% endif -%} {%- if member.isAbstract %}abstract {% endif -%} {%- if member.isStatic %}static {% endif -%} - {%- if (member.isGetAccessor or member.isReadonly) and not member.isSetAccessor %}get {% endif -%} - {%- if member.isSetAccessor and not member.isGetAccessor %}set {% endif -%} {$ 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) $} @@ -192,6 +190,7 @@ {%- if (property.isGetAccessor or property.isReadonly) and not property.isSetAccessor %}Read-only.{% endif %} + {%- if property.isSetAccessor and not property.isGetAccessor %}Write-only.{% endif %} {% if property.shortDescription %}{$ property.shortDescription | marked $}{% endif %} {$ (property.description or property.constructorParamDoc.description) | marked $} {% if property.constructorParamDoc %} Declared in constructor.{% endif %}