From b2962db4cb172bc18f813c1cb3f787dac255d047 Mon Sep 17 00:00:00 2001 From: Ben Lesh Date: Thu, 11 Apr 2019 11:01:01 -0700 Subject: [PATCH] test: add additional test for codeGenApi (#29844) Addresses comments made by @gkalpak in #29820 PR Close #29844 --- .../src/render3/instructions/projection.ts | 2 +- tools/ts-api-guardian/test/unit_test.ts | 39 ++++++++++++++++++- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/packages/core/src/render3/instructions/projection.ts b/packages/core/src/render3/instructions/projection.ts index d47f28b0b0..301b43bc48 100644 --- a/packages/core/src/render3/instructions/projection.ts +++ b/packages/core/src/render3/instructions/projection.ts @@ -75,7 +75,7 @@ export function ɵɵprojectionDef(selectors?: CssSelectorList[]): void { * @param selectorIndex: * - 0 when the selector is `*` (or unspecified as this is the default value), * - 1 based index of the selector from the {@link projectionDef} - * + * * @codeGenApi */ export function ɵɵprojection( diff --git a/tools/ts-api-guardian/test/unit_test.ts b/tools/ts-api-guardian/test/unit_test.ts index 625cf5d2d4..ce5f7260e8 100644 --- a/tools/ts-api-guardian/test/unit_test.ts +++ b/tools/ts-api-guardian/test/unit_test.ts @@ -561,7 +561,7 @@ describe('unit test', () => { {paramTags: {requireAtLeastOne: ['stable']}}); }); - it('should require at least one of the requireOnOf tags', () => { + it('should require at least one of the requireAtLeastOne tags', () => { const input = ` /** @experimental */ export declare class A { @@ -573,6 +573,43 @@ describe('unit test', () => { 'file.d.ts(3,7): error: Required jsdoc tags - One of the tags: "@stable", "@foo", "@bar" - must exist on `param`.', {paramTags: {requireAtLeastOne: ['stable', 'foo', 'bar']}}); }); + + it('should allow with one of the requireAtLeastOne tags found', () => { + const input = ` + /** + * @foo + * @bar + * @stable + */ + export declare class A { + } + /** + * @foo + */ + export declare const b: string; + /** + * @bar + */ + export declare var c: number; + /** + * @stable + */ + export declare function d(): void; + `; + const expected = ` + export declare class A { + } + + export declare const b: string; + + export declare var c: number; + + export declare function d(): void; + `; + check( + {'file.d.ts': input}, expected, + {exportTags: {requireAtLeastOne: ['stable', 'foo', 'bar']}}); + }); }); function getMockHost(files: {[name: string]: string}): ts.CompilerHost {