From f9f47d946ae3afcdbcfc6b552841e3ad8ccfc976 Mon Sep 17 00:00:00 2001 From: Tom Macwright Date: Wed, 12 Apr 2017 12:17:20 -0400 Subject: [PATCH] test(description-tag): Confirm behavior of description tag with tests The `@description` tag allows people to specify a description of a node in any place in the JSDoc comment, instead of only at the beginning. Fixes https://github.com/documentationjs/documentation/issues/341 --- test/fixture/meta.input.js | 3 ++- test/fixture/meta.output.json | 25 +++++++++++++++---------- test/lib/parse.js | 15 +++++++++++++++ 3 files changed, 32 insertions(+), 11 deletions(-) diff --git a/test/fixture/meta.input.js b/test/fixture/meta.input.js index 3ae757562..6a390e06c 100644 --- a/test/fixture/meta.input.js +++ b/test/fixture/meta.input.js @@ -1,6 +1,7 @@ /** - * This function returns the number one. + * This description is ignored because the method has a tagged description. * @returns {number} numberone + * @description This function returns the number one. * @see {@link http://github.com/|github} * @see TestCase * @see [markdown link](http://foo.com/) diff --git a/test/fixture/meta.output.json b/test/fixture/meta.output.json index 38acd1703..9eb923915 100644 --- a/test/fixture/meta.output.json +++ b/test/fixture/meta.output.json @@ -62,40 +62,45 @@ "name": "number" } }, + { + "title": "description", + "description": "This function returns the number one.", + "lineNumber": 3 + }, { "title": "see", "description": "{@link http://github.com/|github}", - "lineNumber": 3 + "lineNumber": 4 }, { "title": "see", "description": "TestCase", - "lineNumber": 4 + "lineNumber": 5 }, { "title": "see", "description": "[markdown link](http://foo.com/)", - "lineNumber": 5 + "lineNumber": 6 }, { "title": "version", "description": "1.0.0", - "lineNumber": 6 + "lineNumber": 7 }, { "title": "since", "description": "2.0.0", - "lineNumber": 7 + "lineNumber": 8 }, { "title": "copyright", "description": "Tom MacWright", - "lineNumber": 8 + "lineNumber": 9 }, { "title": "license", "description": "BSD", - "lineNumber": 9 + "lineNumber": 10 } ], "loc": { @@ -104,18 +109,18 @@ "column": 0 }, "end": { - "line": 11, + "line": 12, "column": 3 } }, "context": { "loc": { "start": { - "line": 12, + "line": 13, "column": 0 }, "end": { - "line": 15, + "line": 16, "column": 2 } } diff --git a/test/lib/parse.js b/test/lib/parse.js index 2e7518520..558979c2a 100644 --- a/test/lib/parse.js +++ b/test/lib/parse.js @@ -107,6 +107,21 @@ test('parse - @augments', function(t) { t.end(); }); +test('parse - @description', function(t) { + t.deepEqual( + evaluate(function() { + /** + * This is a free-form description + * @description This tagged description wins, and [is markdown](http://markdown.com). + */ + })[0].description, + remark().parse('This tagged description wins, and [is markdown](http://markdown.com).'), + 'description' + ); + + t.end(); +}); + /* * Dossier-style augments tag * https://github.com/google/closure-library/issues/746 pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy