From 96552c1a91fe8c0a13d6b14a6483c359af271f49 Mon Sep 17 00:00:00 2001 From: pete hotchkiss Date: Sat, 27 Aug 2016 00:51:12 +0100 Subject: [PATCH 1/5] see annotations class now exposes additional group property --- src/annotation/annotations/see.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/annotation/annotations/see.js b/src/annotation/annotations/see.js index 6b36e267..c7896a71 100644 --- a/src/annotation/annotations/see.js +++ b/src/annotation/annotations/see.js @@ -47,6 +47,7 @@ export default function see (env) { return { description: item.description, context: item.context, + group: item.group, } }) } From 36a4552335d1e0b3a485dab4bcc3176e6d89672e Mon Sep 17 00:00:00 2001 From: pete hotchkiss Date: Sat, 27 Aug 2016 00:56:42 +0100 Subject: [PATCH 2/5] updated tests to allow for new @see annotation group property --- test/annotations/see.test.js | 4 ++-- test/data/expected.json | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/test/annotations/see.test.js b/test/annotations/see.test.js index 95d07185..2ba1bb12 100644 --- a/test/annotations/see.test.js +++ b/test/annotations/see.test.js @@ -11,8 +11,8 @@ describe('#see', function () { }) it('should rewrite the .toJSON method', function () { - var data = [{ description: 'desc', context: { name: 'name' } }, { see: [see.parse('name')] }] + var data = [{ description: 'desc', context: { name: 'name' }, group: 'test' }, { see: [see.parse('name')] }] see.resolve(data) - assert.deepEqual(data[1].see.toJSON(), [{ description: 'desc', context: { name: 'name' } }]) + assert.deepEqual(data[1].see.toJSON(), [{ description: 'desc', context: { name: 'name' }, group: 'test'}]) }) }) diff --git a/test/data/expected.json b/test/data/expected.json index d723782e..bc465ba8 100644 --- a/test/data/expected.json +++ b/test/data/expected.json @@ -699,7 +699,10 @@ "start": 77, "end": 77 } - } + }, + "group": [ + "test" + ] } ], "since": [ From f30447834ac7d0bff24d66acf0fce82bf2c6b455 Mon Sep 17 00:00:00 2001 From: pete hotchkiss Date: Sat, 27 Aug 2016 21:46:00 +0100 Subject: [PATCH 3/5] parsing of alias annotations now passes additional aliasgrouped object with name and group properties (#484) --- src/annotation/annotations/alias.js | 6 ++++++ test/data/expected.json | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/src/annotation/annotations/alias.js b/src/annotation/annotations/alias.js index 98e89c1b..cc80b447 100644 --- a/src/annotation/annotations/alias.js +++ b/src/annotation/annotations/alias.js @@ -14,6 +14,7 @@ export default function alias (env) { let alias = item.alias let name = item.context.name + var aliasGroup = item.group let aliasedItem = Array.find(data, i => i.context.name === alias) @@ -27,7 +28,12 @@ export default function alias (env) { aliasedItem.aliased = [] } + if (!Array.isArray(aliasedItem.aliasedgroup)) { + aliasedItem.aliasedgroup = []; + } + aliasedItem.aliased.push(name) + aliasedItem.aliasedgroup.push({ group: aliasGroup, name: name }) }) }, diff --git a/test/data/expected.json b/test/data/expected.json index bc465ba8..635d13cc 100644 --- a/test/data/expected.json +++ b/test/data/expected.json @@ -503,6 +503,14 @@ "aliased": [ "alias-test" ], + "aliasedgroup": [ + { + "group": [ + "test" + ], + "name": "alias-test" + } + ], "usedBy": [ { "description": "This is a test aiming at testing:\n- autofilled `@requires`\n- autofilled `@error`\n- autofilled `@content`\n", From 2d3bf8f6fe58ed560957ef33069f18d620f879ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Val=C3=A9rian=20Galliat?= Date: Mon, 18 Apr 2022 09:47:32 -0400 Subject: [PATCH 4/5] Lint --- test/annotations/see.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/annotations/see.test.js b/test/annotations/see.test.js index 2ba1bb12..f5209055 100644 --- a/test/annotations/see.test.js +++ b/test/annotations/see.test.js @@ -13,6 +13,6 @@ describe('#see', function () { it('should rewrite the .toJSON method', function () { var data = [{ description: 'desc', context: { name: 'name' }, group: 'test' }, { see: [see.parse('name')] }] see.resolve(data) - assert.deepEqual(data[1].see.toJSON(), [{ description: 'desc', context: { name: 'name' }, group: 'test'}]) + assert.deepEqual(data[1].see.toJSON(), [{ description: 'desc', context: { name: 'name' }, group: 'test' }]) }) }) From b2093f9cc0f1ae4d655d3d6e6269ac89247b9b7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Val=C3=A9rian=20Galliat?= Date: Mon, 18 Apr 2022 09:50:09 -0400 Subject: [PATCH 5/5] Address PR comments --- src/annotation/annotations/alias.js | 8 ++++---- test/data/expected.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/annotation/annotations/alias.js b/src/annotation/annotations/alias.js index cc80b447..4bcc18c4 100644 --- a/src/annotation/annotations/alias.js +++ b/src/annotation/annotations/alias.js @@ -14,7 +14,7 @@ export default function alias (env) { let alias = item.alias let name = item.context.name - var aliasGroup = item.group + let aliasGroup = item.group let aliasedItem = Array.find(data, i => i.context.name === alias) @@ -28,12 +28,12 @@ export default function alias (env) { aliasedItem.aliased = [] } - if (!Array.isArray(aliasedItem.aliasedgroup)) { - aliasedItem.aliasedgroup = []; + if (!Array.isArray(aliasedItem.aliasedGroup)) { + aliasedItem.aliasedGroup = []; } aliasedItem.aliased.push(name) - aliasedItem.aliasedgroup.push({ group: aliasGroup, name: name }) + aliasedItem.aliasedGroup.push({ group: aliasGroup, name: name }) }) }, diff --git a/test/data/expected.json b/test/data/expected.json index 635d13cc..6efed582 100644 --- a/test/data/expected.json +++ b/test/data/expected.json @@ -503,7 +503,7 @@ "aliased": [ "alias-test" ], - "aliasedgroup": [ + "aliasedGroup": [ { "group": [ "test"