diff --git a/aio/tests/e2e/api.e2e-spec.ts b/aio/tests/e2e/api.e2e-spec.ts index bcd292cc57..d85010d1c8 100644 --- a/aio/tests/e2e/api.e2e-spec.ts +++ b/aio/tests/e2e/api.e2e-spec.ts @@ -40,4 +40,14 @@ describe('Api pages', function() { const page = new ApiPage('api/common/HashLocationStrategy'); expect(page.getOverview('class').getText()).toContain('path(includeHash: boolean = false): string'); }); + + it('should show a "Properties" section if there are public properties', () => { + const page = new ApiPage('api/core/ViewContainerRef'); + expect(page.getSection('instance-properties').isPresent()).toBe(true); + }); + + it('should not show a "Properties" section if there are only internal properties', () => { + const page = new ApiPage('api/forms/FormControl'); + expect(page.getSection('instance-properties').isPresent()).toBe(false); + }); }); diff --git a/aio/tests/e2e/api.po.ts b/aio/tests/e2e/api.po.ts index d16070d1f1..dcf9f0371e 100644 --- a/aio/tests/e2e/api.po.ts +++ b/aio/tests/e2e/api.po.ts @@ -31,4 +31,8 @@ export class ApiPage extends SitePage { getOverview(docType) { return element(by.css(`.${docType}-overview`)); } + + getSection(cls) { + return element(by.css(`section.${cls}`)); + } } diff --git a/aio/tools/transforms/templates/api/lib/memberHelpers.html b/aio/tools/transforms/templates/api/lib/memberHelpers.html index 199b8d0ea1..6deda7f58e 100644 --- a/aio/tools/transforms/templates/api/lib/memberHelpers.html +++ b/aio/tools/transforms/templates/api/lib/memberHelpers.html @@ -106,36 +106,40 @@ {% endmacro -%} {%- macro renderMethodDetails(methods, containerClass, itemClass, headingText) -%} -{% if methods.length %} +{% set nonInternalMethods = methods | filterByPropertyValue('internal', undefined) %} +{% if nonInternalMethods.length %}

{$ headingText $}

- {% for member in methods %}{% if not member.internal %} + {% for member in nonInternalMethods %} {$ renderMethodDetail(member, itemClass) $} - {% endif %}{% endfor %} + {% endfor %}
{% endif %} {%- endmacro -%} {%- macro renderProperties(properties, containerClass, propertyClass, headingText) -%} -{%- if properties.length -%} -

{$ headingText $}

- - - - - - {% for property in properties %}{% if not property.internal %} - - - - - - {% endif %}{% endfor %} - -
PropertyTypeDescription
{$ property.name $} - {$ (property.description or property.constructorParamDoc.description) | marked $} - {% if property.constructorParamDoc %} Declared in constructor.{% endif %} -
+{% set nonInternalProperties = properties | filterByPropertyValue('internal', undefined) %} +{% if nonInternalProperties.length -%} +
+

{$ headingText $}

+ + + + + + {% for property in nonInternalProperties %} + + + + + + {% endfor %} + +
PropertyTypeDescription
{$ property.name $} + {$ (property.description or property.constructorParamDoc.description) | marked $} + {% if property.constructorParamDoc %} Declared in constructor.{% endif %} +
+
{%- endif -%} {%- endmacro -%}