diff --git a/src/annotation/annotations/alias.js b/src/annotation/annotations/alias.js index 98e89c1b..4bcc18c4 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 + let 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/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, } }) } diff --git a/test/annotations/see.test.js b/test/annotations/see.test.js index 95d07185..f5209055 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..6efed582 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", @@ -699,7 +707,10 @@ "start": 77, "end": 77 } - } + }, + "group": [ + "test" + ] } ], "since": [