build(docs-infra): simplify property syntax rendering (#25768)

PR Close #25768
This commit is contained in:
Pete Bacon Darwin 2018-09-26 13:39:51 +01:00 committed by Alex Rickabaugh
parent 783a682a7d
commit 7373da9b11
3 changed files with 3 additions and 9 deletions

View File

@ -96,7 +96,7 @@
}
}
.from-constructor, .read-only-property {
.from-constructor, .read-only-property, .write-only-property {
font-style: italic;
color: $blue;
}

View File

@ -38,14 +38,9 @@ describe('Api pages', function() {
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');
expect(page.getOverview('class').getText()).toContain('injector: Injector');
});
it('should show both type and initializer if set', () => {

View File

@ -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 -%}
<span class="member-name">{$ member.name $}</span>{$ 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 @@
</td>
<td>
{%- if (property.isGetAccessor or property.isReadonly) and not property.isSetAccessor %}<span class='read-only-property'>Read-only.</span>{% endif %}
{%- if property.isSetAccessor and not property.isGetAccessor %}<span class='write-only-property'>Write-only.</span>{% endif %}
{% if property.shortDescription %}{$ property.shortDescription | marked $}{% endif %}
{$ (property.description or property.constructorParamDoc.description) | marked $}
{% if property.constructorParamDoc %} <span class='from-constructor'>Declared in constructor.</span>{% endif %}