From ad6b18f23dd027f1a29546495d9086a294ff01a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Zori=C4=87?= Date: Thu, 14 Jan 2021 09:56:38 +0100 Subject: [PATCH] ci(category): add property IDs to category in specs - test should fail --- src/lib/converter/plugins/CategoryPlugin.ts | 11 ++++++++--- src/test/converter/class/class.ts | 1 + .../converter/class/specs-with-lump-categories.json | 3 ++- src/test/converter/class/specs.json | 3 ++- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/lib/converter/plugins/CategoryPlugin.ts b/src/lib/converter/plugins/CategoryPlugin.ts index 9859bf764..cee6b1ae4 100644 --- a/src/lib/converter/plugins/CategoryPlugin.ts +++ b/src/lib/converter/plugins/CategoryPlugin.ts @@ -187,7 +187,11 @@ export class CategoryPlugin extends ConverterComponent { commentTags.push(tag); return; } - categories.push(tag.text.trim()); + const text = tag.text.trim(); + if (!text) { + return; + } + categories.push(text); }); comment.tags = commentTags; return categories; @@ -204,8 +208,9 @@ export class CategoryPlugin extends ConverterComponent { if (!signature.comment) { return categories; } - categories.push(...extractCategoryTag(signature.comment)); - return categories; + return categories.concat( + extractCategoryTag(signature.comment) + ); }, [] ); diff --git a/src/test/converter/class/class.ts b/src/test/converter/class/class.ts index 85415c119..fd2ffff6b 100644 --- a/src/test/converter/class/class.ts +++ b/src/test/converter/class/class.ts @@ -28,6 +28,7 @@ export class TestClass { /** * publicMethod short text. + * @category AnotherTest * @category Test */ public publicMethod() {} diff --git a/src/test/converter/class/specs-with-lump-categories.json b/src/test/converter/class/specs-with-lump-categories.json index 9d7fc36d2..215fb1f8d 100644 --- a/src/test/converter/class/specs-with-lump-categories.json +++ b/src/test/converter/class/specs-with-lump-categories.json @@ -909,7 +909,8 @@ "title": "AnotherTest", "children": [ 32, - 30 + 30, + 28 ] }, { diff --git a/src/test/converter/class/specs.json b/src/test/converter/class/specs.json index 427bc8b5b..d16ebebe2 100644 --- a/src/test/converter/class/specs.json +++ b/src/test/converter/class/specs.json @@ -907,7 +907,8 @@ "title": "AnotherTest", "children": [ 32, - 30 + 30, + 28 ] }, {