diff --git a/aio/tests/e2e/api.e2e-spec.ts b/aio/tests/e2e/api.e2e-spec.ts index 9ff6625eef..c556ed11e7 100644 --- a/aio/tests/e2e/api.e2e-spec.ts +++ b/aio/tests/e2e/api.e2e-spec.ts @@ -8,7 +8,19 @@ describe('Api pages', function() { it('should show direct and indirect subclasses of a class', () => { const page = new ApiPage('api/forms/AbstractControlDirective'); - expect(page.getDescendants('class')).toEqual(['ControlContainer', 'AbstractFormGroupDirective', 'NgControl']); + expect(page.getDescendants('class')).toEqual([ + 'ControlContainer', + 'AbstractFormGroupDirective', + 'NgModelGroup', + 'FormGroupName', + 'NgForm', + 'FormGroupDirective', + 'FormArrayName', + 'NgControl', + 'NgModel', + 'FormControlDirective', + 'FormControlName' + ]); }); it('should show child interfaces that extend an interface', () => { diff --git a/aio/tools/transforms/angular-base-package/rendering/filterByPropertyValue.js b/aio/tools/transforms/angular-base-package/rendering/filterByPropertyValue.js index 9b3c3b6fca..001b4b24b6 100644 --- a/aio/tools/transforms/angular-base-package/rendering/filterByPropertyValue.js +++ b/aio/tools/transforms/angular-base-package/rendering/filterByPropertyValue.js @@ -3,7 +3,12 @@ module.exports = function filterBy() { name: 'filterByPropertyValue', process: function(list, property, value) { if (!list) return list; - return list.filter(item => item[property] === value); + const values = Array.isArray(value) ? value : [value]; + return list.filter(item => values.some(value => compare(item[property], value))); } }; -}; \ No newline at end of file +}; + +function compare(actual, expected) { + return expected instanceof(RegExp) ? expected.test(actual) : actual === expected; +} \ No newline at end of file diff --git a/aio/tools/transforms/angular-base-package/rendering/filterByPropertyValue.spec.js b/aio/tools/transforms/angular-base-package/rendering/filterByPropertyValue.spec.js index d2c5823bb5..b3874d7931 100644 --- a/aio/tools/transforms/angular-base-package/rendering/filterByPropertyValue.spec.js +++ b/aio/tools/transforms/angular-base-package/rendering/filterByPropertyValue.spec.js @@ -7,8 +7,19 @@ describe('filterByPropertyValue filter', () => { it('should be called "filterByPropertyValue"', function() { expect(filter.name).toEqual('filterByPropertyValue'); }); - it('should filter out items that do not match the given property value', function() { + it('should filter out items that do not match the given property string value', function() { expect(filter.process([{ a: 1 }, { a: 2 }, { b: 1 }, { a: 1, b: 2 }, { a: null }, { a: undefined }], 'a', 1)) .toEqual([{ a: 1 }, { a: 1, b: 2 }]); }); + + + it('should filter out items that do not match the given property regex value', function() { + expect(filter.process([{ a: '1' }, { a: '12' }, { b: '1' }, { a: 'a' }, { a: '1', b: '2' }, { a: null }, { a: undefined }], 'a', /\d/)) + .toEqual([{ a: '1' }, { a: '12' }, { a: '1', b: '2' }]); + }); + + it('should filter out items that do not match the given array of property regex/string values', function() { + expect(filter.process([{ a: '1' }, { a: '12' }, { b: '1' }, { a: 'a' }, { a: '1', b: '2' }, { a: null }, { a: undefined }], 'a', [/\d/, 'a'])) + .toEqual([{ a: '1' }, { a: '12' }, { a: 'a' }, { a: '1', b: '2' }]); + }); }); \ No newline at end of file diff --git a/aio/tools/transforms/templates/api/includes/class-overview.html b/aio/tools/transforms/templates/api/includes/class-overview.html index 03807862a1..64f4f388c7 100644 --- a/aio/tools/transforms/templates/api/includes/class-overview.html +++ b/aio/tools/transforms/templates/api/includes/class-overview.html @@ -6,5 +6,5 @@ {% if doc.isAbstract %}abstract {% endif%}class {$ doc.name $}{$ doc.typeParams | escape $}{$ memberHelper.renderHeritage(doc) $} {{$ memberHelper.renderMembers(doc) $} } -{$ descendants.renderDescendants(doc, 'class', 'Subclasses') $} +{$ descendants.renderDescendants(doc, 'class', 'Subclasses', true, r/class|directive|pipe|decorator/) $} diff --git a/aio/tools/transforms/templates/api/includes/interface-overview.html b/aio/tools/transforms/templates/api/includes/interface-overview.html index 7b2b8d6b06..15df777c8e 100644 --- a/aio/tools/transforms/templates/api/includes/interface-overview.html +++ b/aio/tools/transforms/templates/api/includes/interface-overview.html @@ -6,5 +6,5 @@ interface {$ doc.name $}{$ doc.typeParams | escape $}{$ memberHelper.renderHerit } {$ descendants.renderDescendants(doc, 'interface', 'Child interfaces') $} -{$ descendants.renderDescendants(doc, 'class', 'Class implementations') $} +{$ descendants.renderDescendants(doc, 'class', 'Class implementations', true, r/class|directive|pipe|decorator/) $} \ No newline at end of file diff --git a/aio/tools/transforms/templates/api/lib/descendants.html b/aio/tools/transforms/templates/api/lib/descendants.html index 73b097a1a9..4f78d6212b 100644 --- a/aio/tools/transforms/templates/api/lib/descendants.html +++ b/aio/tools/transforms/templates/api/lib/descendants.html @@ -1,22 +1,22 @@ -{% macro renderDescendantList(descendants, docType, recursed) %} +{% macro renderDescendantList(descendants, descendantType, recursed, docTypeMatcher) %} {% if descendants.length %}
{$ descendant.name $}
- {$ renderDescendantList(descendant.descendants | filterByPropertyValue('docType', docType), docType, recursed) $}
+ {$ renderDescendantList(descendant.descendants | filterByPropertyValue('docType', docTypeMatcher), docType, recursed, docTypeMatcher) $}